Wpf 如何实现由另一个绑定绑定的绑定路径?
我正在编写自己的UserControl,它在列表框中显示数据。我想实现类似“DisplayMemberPath”这样的属性。在我的示例中,它是“EditableMemberPath”,它应该确定文本框中将显示哪个成员。但是,在绑定上使用绑定不起作用Wpf 如何实现由另一个绑定绑定的绑定路径?,wpf,data-binding,Wpf,Data Binding,我正在编写自己的UserControl,它在列表框中显示数据。我想实现类似“DisplayMemberPath”这样的属性。在我的示例中,它是“EditableMemberPath”,它应该确定文本框中将显示哪个成员。但是,在绑定上使用绑定不起作用 <ListBox ItemsSource="{Binding Path=Items, ElementName=me}" SelectedItem="{Binding Path=SelectedItem, ElementName
<ListBox ItemsSource="{Binding Path=Items, ElementName=me}"
SelectedItem="{Binding Path=SelectedItem, ElementName=me}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<Image Source="{Binding Converter={Binding Path=ItemToImageConverter, ElementName=me}}" />
<TextBlock Text="{Binding Path={Binding Path=EditableMemberPath, ElementName=me}}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
你能帮我找到一个合适的解决办法吗
致以最诚挚的问候Oliver Hanappi您不能在XAML中直接执行此操作(至少不能使用内置类):绑定
不是依赖对象,因此您不能绑定其属性
然而,Martin Harris提到的帖子看起来很有希望……我在这里发布了回答这个问题的代码: