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>
谢谢