0
假设你有一个列表,看起来像下面数据绑定另一个数据绑定控件中 - 根据当前项目
public List<Person> Persons { get; set; }
您在ListBox
设置ItemSource
摆脱人及数据该列表中的每个人都希望选择其他项目,具体取决于社会安全号码。
这不是将数据存储在Person中的选项,因此一旦在列表中处理Person,就必须提取数据。
这将最终看起来有点像这样OM XAML
<ListBox Name="myListBox">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<Label Content="{Binding Name}"/>
<ComboBox ItemsSource="{Binding MyOtherData}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
现在,我想MyOtherData是一种方法,其将返回一组数据,根据当前的人,所以我只是想有一个方法,羚牛像社会安全号码的论点。
这看起来怎么样?
我对WPF-XAML的东西很陌生,如果这是一个设计缺陷,请提供其他解决方案。