Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WPF对象将自身作为多绑定路径发送_Wpf_Data Binding_Hierarchicaldatatemplate_Multibinding - Fatal编程技术网

WPF对象将自身作为多绑定路径发送

WPF对象将自身作为多绑定路径发送,wpf,data-binding,hierarchicaldatatemplate,multibinding,Wpf,Data Binding,Hierarchicaldatatemplate,Multibinding,基本上,我需要知道的是如何将HierarchycalDataTemplate的源代码发送到绑定中,这就是我所拥有的: <HierarchicalDataTemplate DataType="{x:Type myModel:Person}"> <StackPanel Orientation="Horizontal"> <Image Source="Images\User.gif" /> <TextBlock Marg

基本上,我需要知道的是如何将
HierarchycalDataTemplate
的源代码发送到绑定中,这就是我所拥有的:

<HierarchicalDataTemplate DataType="{x:Type myModel:Person}">
    <StackPanel Orientation="Horizontal">
        <Image Source="Images\User.gif" />
        <TextBlock Margin="5,0,0,0" Text="{Binding Name}" />
    </StackPanel>
    <HierarchicalDataTemplate.ItemsSource>
        <MultiBinding Converter="{StaticResource PersonConverter}">
            <Binding Path="Name" />
            <!-- Here I need something like Binding Path="Self" so I can send the source of the binding (the "Person" object) -->
        </MultiBinding>
    </HierarchicalDataTemplate.ItemsSource>
</HierarchicalDataTemplate>

因此,我的源代码是类型为
myModel:Person
的对象,我希望能够在
MultiBinding
中发送对象本身,以便
PersonConverter
可以使用它


谢谢你的帮助。

哇,我做了一个疯狂的疯狂猜测,结果成功了=哈哈,这是解决办法

<MultiBinding Converter="{StaticResource PersonConverter}">
    <Binding Path="Name" />
    <Binding Path="." /> <!-- this sends the source of the binding -->
</MultiBinding>

谢谢