WPF对象将自身发送为MultiBinding路径

Car*_*rlo 4 data-binding wpf hierarchicaldatatemplate multibinding

基本上我需要知道的是如何将一个源发送HierarchicalDataTemplate到一个绑定,这就是我所拥有的:

<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>
Run Code Online (Sandbox Code Playgroud)

所以我的源代码是一个类型的对象myModel:Person,我希望能够发送对象本身,MultiBinding以便PersonConverter可以使用它.

谢谢你的帮助.

Car*_*rlo 14

哇,我做了一个疯狂的疯狂猜测,它的工作= S lol,这是解决方案

<MultiBinding Converter="{StaticResource PersonConverter}">
    <Binding Path="Name" />
    <Binding Path="." /> <!-- this sends the source of the binding -->
</MultiBinding>
Run Code Online (Sandbox Code Playgroud)

谢谢!