BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi there, I am trying to bind SelectedItems property to a ObservableCollection in a view model with two way binding, but it looks like the ObservableCollection doesn't update when I select multiple items in the datagrid.
I looked at the grid documentation and looks like it has setter and getter, so why it doesn't work?
Thanks,
Kent
Hi Kent,
Sorry for the Delay caused,
We have analyzed your query. We don’t have direct
support to bind the SelectedItems value in GridDataControl.Because SelectedItems
property is not a DependencyProperty. However you can use CollectionChanged
event to get SelectedItems Value.You can refer the below codesnippet to achieve
your requirement.
Codesnippet[XAML]:
gdc.SelectedItems.CollectionChanged
+= (sender, e) => { };
|
If you want to bind the SelectedItems value.Please
refer the below codesnippet.
Codesnippet[XAML]:
<syncfusion:GridDataControl x:Name="DataGrid"
ItemsSource="{Binding GDCSource}" ShowAddNewRow="False" AutoPopulateColumns="False" AllowSelection="Row" ListBoxSelectionMode="MultiExtended"
local:GDCAttachedProperty.EnableSelectedItemBinding="True" local:GDCAttachedProperty.SelectedItems="{Binding
SelectedItems, Mode=TwoWay}" > |
We have prepared a sample based on this, please find
the attached sample below,
Please let us know if you have any queries,
Regards,
Saravanan.M
Hi Butler,
Sorry for the inconvenience,
You can download the sample from below location.
Sample Location: GridDataControlSample_SelectedItemsBinding.zip
Regards,
Saravanan.M