【发布时间】:2017-03-15 11:21:42
【问题描述】:
我有 Tab 所在的选项卡列表:
public class Tab
{
public int Id {get; set;}
public string Name {get; set}
public List<country> Country {get; set;}
}
现在,我想将它绑定到两个组合框: 第一个组合框没问题,但第二个我想显示国家/地区列表。
<custom:ComboBox Title="Tab"
ItemsSource="{Binding Tabs, Mode=TwoWay}"
ValuePath="Id"
Value="{Binding Model.Id, Mode=TwoWay}"
DisplayPath="Name"
IsEnabled="{Binding IsEnabled, Mode=TwoWay}"/>
<custom:ComboBox Title="Country"
SelectedItem="{Binding Model.Country, Mode=TwoWay}"
ItemsSource="{}"
DisplayPath="CountryName"
IsEnabled="{Binding IsEnabled, Mode=TwoWay}"/>
当我知道 Id 时,如何在第二个组合框中设置 ItemsSource。 是不是创建变量的另一种方法,比如 selectedList 然后绑定到它?
编辑
我正在创建新对话框,我正在发送带有标签 ID 的模型,并且对话框上下文有标签列表。
【问题讨论】: