CheckListBox SelectedItems Binding

I have a CheckListBox that is bound to my view model. The ItemsSource is updating properly, but I am unable to retrieve the selected/checked items in my view model. Any suggestions?

Xaml:

<syncfusion:CheckListBox IsCheckOnFirstClick="True" Grid.Row="2" VerticalAlignment="Stretch" ItemsSource="{Binding FilteredSymbols}" SelectedItems="{Binding SelectedSymbols}" DisplayMemberPath="BaseAsset">
                            <syncfusion:CheckListBox.ItemContainerStyle>
                                <Style TargetType="syncfusion:CheckListBoxItem">
                                    <Setter Property="IsSelected" Value="{Binding IsChecked, Mode=TwoWay}"/>
                                </Style>
                            </syncfusion:CheckListBox.ItemContainerStyle>
                        </syncfusion:CheckListBox>

View Model:

private ObservableCollection<BinanceSymbol> selectedSymbols = new ObservableCollection<BinanceSymbol>();
        private ObservableCollection<BinanceSymbol> filteredSymbols = new ObservableCollection<BinanceSymbol>();


public ObservableCollection<BinanceSymbol> SelectedSymbols
        {
            get { return selectedSymbols; }
            set { selectedSymbols = value; RaisePropertyChangedEvent(nameof(SelectedSymbols)); }
        }


        public ObservableCollection<BinanceSymbol> FilteredSymbols
        {
            get { return filteredSymbols; }
            set { filteredSymbols = value; RaisePropertyChangedEvent(nameof(FilteredSymbols)); }
        }

1 Reply

SN Sudharsan Narayanan Syncfusion Team October 5, 2021 03:57 AM UTC

Hi Tyler,

Thanks for contacting Syncfusion support,

We have checked the reported issue that “Checked items retrieve from view model” from our end. We have prepared the sample to achieve your requirement. So, please check the below sample for the reference,

Sample: https://www.syncfusion.com/downloads/support/forum/169345/ze/CheckListBoxChecked-1269478989

Please check the sample and let me know your concerns, If we are misunderstood the query, Please modify the sample, and revert to us with reproducible issue. So, it will be helpful to prompt the solution on further.

Regards,
Sudharsan


Loader.
Up arrow icon