We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

SelectedItems property fro GridDataControl

Thread ID:

Created:

Updated:

Platform:

Replies:

113876 Oct 14,2013 06:48 AM Mar 9,2015 01:53 AM WPF 4
loading
Tags: GridControl
kentzheng
Asked On October 14, 2013 06:48 AM

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

 


Saravanan M [Syncfusion]
Replied On November 19, 2013 08:47 AM

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



GridDataControlSample_SelectedItemsBinding_1ed717ad.zip

Mahesh SanthaMoorthy
Replied On September 15, 2014 07:41 AM

Hi Team,

I need to view the sample attached in the solution given.

Carey G. Butler
Replied On March 8, 2015 10:24 AM

The zip file is damaged.

Saravanan M [Syncfusion]
Replied On March 9, 2015 01:53 AM

Hi Butler,

Sorry for the inconvenience,

You can download the sample from below location.

Sample Location: GridDataControlSample_SelectedItemsBinding.zip

Regards,

Saravanan.M



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;