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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SelectedItems property fro GridDataControl

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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 01:47 PM UTC

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 11:41 AM UTC

Hi Team,

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

Carey G. Butler
Replied On March 8, 2015 02:24 PM UTC

The zip file is damaged.

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

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.

Warning Icon 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.Close Icon

;