DATAMODEL
A PhotoPlace具有一个Country。一个国家有一个潜在区域列表(AllRegions)和一个具体区域(SelectedRegion)。该模型包含所有可用国家(AllCountries)的列表。 CurrentPhotoPlace当前在UI中显示的照片位置。
功能
当您从组合框中选择一个国家时,带有区域的组合框应仅显示属于所选国家的区域。 CurrentPhotoPlace.Country和CurrentPhotoPlace.Country.SelectedRegion应根据用户选择通过绑定进行更新。
XAML
<ComboBox Name="PhotoPlaceCountryComboBox"
ItemsSource="{Binding AllCountries}"
DisplayMemberPath="Name"
SelectedItem="{Binding CurrentPhotoPlace.Country, Mode=TwoWay}">
</ComboBox>
<ComboBox Name="PhotoPlaceRegionComboBox"
ItemsSource="{Binding CurrentPhotoPlace.Country.AllRegions}"
DisplayMemberPath="Name"
SelectedItem="{Binding CurrentPhotoPlace.Country.SelectedRegion}" >
</ComboBox>
问题选择其他国家/地区后,当前解决方案将无法使用。
非常感谢您的帮助
没有看到代码,很难指出问题,但是这里有一些可能的原因: