我正在编写自己的用户控件,它在列表框中显示数据。我想实现类似于“DisplayMemberPath”的属性。在我的示例中,它是“editablememberpath”,它应该决定在文本框中显示哪个成员。但是,在绑定上使用绑定不起作用。
<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>
你能帮我找到一个合适的解决办法吗?
最好的问候
奥利弗哈纳皮