Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf 绑定两个相关属性的更简洁的方法_Wpf_Entity Framework - Fatal编程技术网

Wpf 绑定两个相关属性的更简洁的方法

Wpf 绑定两个相关属性的更简洁的方法,wpf,entity-framework,Wpf,Entity Framework,我有一个名为GACC的项目列表和一个名为Zone的项目列表,以及两个下拉列表。什么时候 Gacc下拉列表将更改,Gacc中的区域列表将更改。Gacc是一个永不更改的全局列表,设置如下: var gacclist = (from d in ctx.GACCS select d).Distinct(); radGACC.ItemsSource = gacclist; 然后设置xaml: <telerik:RadComboBox

我有一个名为GACC的项目列表和一个名为Zone的项目列表,以及两个下拉列表。什么时候 Gacc下拉列表将更改,Gacc中的区域列表将更改。Gacc是一个永不更改的全局列表,设置如下:

 var gacclist = (from d in ctx.GACCS
                        select d).Distinct();
        radGACC.ItemsSource = gacclist;
然后设置xaml:

<telerik:RadComboBox Name="radGACC" DisplayMemberPath="Name" Grid.Row="1" Grid.Column="0" IsEditable="True" SelectedIndex="0" VerticalAlignment="Center" Height="22" />
    <telerik:RadComboBox Name="radZone" Grid.Row="1" Grid.Column="1" IsEditable="True" SelectedIndex="0" VerticalAlignment="Center" Height="22" />

如何使用绑定,以便radZone下拉列表中的区域列表自动显示所选gacc中的区域?我本来打算在radGacc更改时使用一个事件并更改radZone,但我认为可能有更好的方法使用一些奇特的绑定。谢谢

编辑:一个gacc包含许多区域,因此这是一个非常简单的关系。

试试这个

<telerik:RadComboBox Name="radGACC" DisplayMemberPath="Name" Grid.Row="1" Grid.Column="0" IsEditable="True" SelectedIndex="0" VerticalAlignment="Center" Height="22" />
<telerik:RadComboBox Name="radZone" Grid.Row="1" Grid.Column="1" IsEditable="True" SelectedIndex="0" VerticalAlignment="Center" Height="22" ItemsSource="{Binding SelectedItem.Zones, ElementName=radGACC}"/>

ItemsSource=“{Binding SelectedItem.Zones,ElementName=radGACC}”


这将把ItemSource绑定到所选GACC的区域。am假设区域是特定GACC区域的属性名称。我希望这将有助于

GACC和分区之间的关系是什么?一个GACC包含许多分区。啊,这非常有意义。非常感谢你!