Databinding 2 wpf 콤보해스는 "링크"되지 않고 1 소스로
-
02-07-2019 - |
문제
ObjectDatasourceProvider의 Combobox 리스팅 회사가 1 개있는 마스터 디테일 시나리오가 있습니다. 그 아래에는 현재 회사 객체에서 접촉 속성에 바인딩되는 2 개의 콤보 박스가 있습니다. 각 콤보 박스에서 다른 접촉을 선택할 수 있어야합니다. 그러나 한 목록에서 선택을 변경하자마자 다른 목록은 동일한 연락처에 대한 업데이트됩니다.
나는 다른 설정 (Oneway vs. Twoway)을 시도했지만 지금까지 아무것도 작동하지 않는 것 같습니다. 여기 내 XAML의 발췌가 있습니다.
<Page.Resources>
<!-- This is a custom class inheriting from ObjectDataProvider -->
<wg:CustomersDataProvider x:Key="CompanyDataList" />
</Page.Resources>
<Grid>
<!--- other layout XAML removed -->
<ComboBox x:Name="Customer" Width="150"
ItemsSource="{Binding Source={StaticResource CompanyDataList},Path=Companies,Mode=OneWay}"
DisplayMemberPath="Name"
SelectedValuePath="Id"
IsSynchronizedWithCurrentItem="True"
SelectedValue="{Binding Path=Id, Mode=OneWay}"
VerticalAlignment="Bottom" />
<ComboBox x:Name="PrimaryContact" Width="150"
DataContext="{Binding ElementName=Customer,Path=Items,Mode=OneWay}"
ItemsSource="{Binding Path=Contacts,Mode=OneWay}"
DisplayMemberPath="FullName"
SelectedValuePath="Id"
IsSynchronizedWithCurrentItem="True"
SelectedValue="{Binding Path=Id,Mode=OneWay}" />
<ComboBox x:Name="AdminContact" Width="150"
DataContext="{Binding ElementName=OwnerCustomer,Path=Items,Mode=OneWay}"
ItemsSource="{Binding Path=Contacts,Mode=OneWay}"
DisplayMemberPath="FullName"
SelectedValuePath="Id"
IsSynchronizedWithCurrentItem="True"
SelectedValue="{Binding Path=Id,Mode=OneWay}" />
<!--- other layout XAML removed -->
</Grid>
CollectionViewSource를 만드는 것이 갈 길이라고 생각했지만 그 일을 할 수 없었습니다. 이 작업을 수행하는 간단한 방법이 있습니까?
해결책
당신의 변화 "issynchronized withCurrentEM""거짓 "의 속성.
제휴하지 않습니다 StackOverflow