我对xceed
CheckComboBox
有疑问。
让我说我有这段代码:
<xceed:CheckComboBox Grid.Row="0" Grid.Column="1" Margin="2"
ItemsSource="{Binding Path=ListOfCostCenters}"
DisplayMemberPath="LoadingCenterCode"
SelectedItemsOverride="{Binding Path=SelectedCostCenters,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}">
<!--<i:Interaction.Triggers>
<i:EventTrigger EventName="ItemSelectionChanged">
<i:InvokeCommandaction Command="{Binding Path=CompareSelectionCmd}"/>
</i:EventTrigger>
</i:Interaction.Triggers>-->
</xceed:CheckComboBox>
组合框已正常填充。但是没有检查我从XML加载的选定项目。为什么?
我这样加载XML:
List<LoadingCenter> selectedLoadingCentersXml = _moduleConfig.getconfig<UserConfig>().LoadingCenters;
//We need to get the same Object which is in ItemSource (CostCenters) of checkBox component.
foreach (LoadingCenter center1 in selectedLoadingCentersXml)
{
selectedLoadingCenters.Add(center1);
}
if (selectedLoadingCenters.Count > 0)
{
//Fill the property with list of objects from CostCenters which are the same with objects from loaded XML file.
SelectedCostCenters = new ObservableCollection<LoadingCenter>(selectedLoadingCenters);
}
else if (selectedLoadingCenters.Count == 0)
{
SelectedCostCenters = new ObservableCollection<LoadingCenter>();
}
我将XML文件存储在我从中读取的数据库中。