Wpf 无法使用MVVM通过Xceed复选框获取SelectedItems

Wpf 无法使用MVVM通过Xceed复选框获取SelectedItems,wpf,mvvm,xceed,checklistbox,Wpf,Mvvm,Xceed,Checklistbox,我一直在为一些UI组件使用wpf xceed第三方库。我真的很喜欢屏幕上显示CheckListBox的方式。但是我无法将selectedItems绑定到viewmodel中setter从未触发的任何属性。这是密码- 我正在使用数据提供程序从enum获取值- <UserControl.Resources> <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="De

我一直在为一些UI组件使用wpf xceed第三方库。我真的很喜欢屏幕上显示CheckListBox的方式。但是我无法将selectedItems绑定到viewmodel中setter从未触发的任何属性。这是密码-

我正在使用数据提供程序从enum获取值-

 <UserControl.Resources>
    <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="DeviceClassDataProvider">
        <ObjectDataProvider.MethodParameters>
            <x:Type TypeName="Model:HANDeviceClass" />
        </ObjectDataProvider.MethodParameters>
    </ObjectDataProvider>
然后控件被声明为类似这样的东西-

<ext:CheckListBox Focusable="False" SelectedMemberPath="{Binding IsChecked, UpdateSourceTrigger=PropertyChanged}" SelectedItemsOverride="{Binding SelectedDeviceGroups, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.Row="1" Grid.RowSpan="7" Grid.Column="4" Padding="5" BorderThickness="0.8" BorderBrush="Gray" ItemsSource="{Binding Source={StaticResource DeviceClassDataProvider}}"/>
如何在其viewmodel中获取所选项目

任何快速的帮助都将不胜感激

如果SelectedDeviceGroups是一个返回ICollection的公共属性,那么“提前感谢”

应该可以工作:

XAML:


当您分别选中和取消选中项目时,项目将被添加到源集合中并从源集合中删除。

我在setter上有一个断点,但它从未命中该断点。看起来getter很管用。谢谢:
public ICollection<HANDeviceClass> SelectedDeviceGroups { get; } = new ObservableCollection<HANDeviceClass>();
<ext:CheckListBox ItemsSource="{Binding Source={StaticResource DeviceClassDataProvider}}"
                  SelectedItemsOverride="{Binding SelectedDeviceGroups}" />

<TextBlock Text="{Binding SelectedDeviceGroups.Count}" />