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.
Syncfusion Feedback

GridDataControl bind to selected rows

Thread ID:

Created:

Updated:

Platform:

Replies:

108717 May 8,2013 11:21 AM UTC Jun 4,2013 12:27 PM UTC WPF 1
loading
Tags: GridControl
Brian Harkness
Asked On May 8, 2013 11:21 AM UTC

Hi,
 
I'm using MVVM to bind my collection to a grid, I can get the current item by using ICollectionView, however I need to allow the grid to select multiple rows, and so I need to be notified when the selection changes, but I can't bind to the SelectedItems property as it's not a dependency property, so is there a way to achieve this?
 
Ideally I would like to bind a property of each item to the 'selected' state for the corresponding grid row.
 
Thanks,
 
Brian

Thangapriya V [Syncfusion]
Replied On June 4, 2013 12:27 PM UTC

Hi Brian,

Sorry for the delay caused.

We have analyzed your query. You cannot bind the SelectedItems property of the GridDataControl. However you can get the selected items by using SelectedItems.CollectionChanged event. You can refer the following code snippet for this.

 

Code snippet[C#]:

 

grid.SelectedItems.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedItems_CollectionChanged);

 

void SelectedItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)

        {

            if (e.NewItems != null)

            {

                foreach (var item in e.NewItems)

                {

                    var record = item as Data;

                    Console.WriteLine("Customer Id" + " "+ record.CustomerID);

                }

            }

        }

 

 

We have prepared a sample based on this. And you can find the sample in the following location.

Please let us know if you have any queries.

Regards,

Thangapriya



GridDataControlICollectionView 1_7da67ef8.zip

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

;