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.

Notification on SelectRows()

Thread ID:

Created:

Updated:

Platform:

Replies:

127747 Dec 6,2016 09:57 AM Dec 11,2016 11:58 PM WPF 3
loading
Tags: SfDataGrid
Bernd
Asked On December 6, 2016 09:57 AM

Hi,

I was wondering if SfDataGrid.SelectionChanged whould also be called when programatically selecting rows with SelectRows(r1, r2)?

Actually it does not trigger the notification. IS this a bug or am I doing something wrong?

Regards
Bernd

Jai Ganesh S [Syncfusion]
Replied On December 8, 2016 09:12 AM

Hi Bernd, 
We regret to inform you that, the SelectionChanged event will not be fired while we select the rows programmatically. This is the default behavior of SfDataGrid. However, you can get the notification while calling the SelectRows by using SelectedItems.CollectionChanged event like below, 
 this.datagrid.SelectedItems.CollectionChanged += SelectedItems_CollectionChanged; 
 
 private void SelectedItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) 
        { 
            var selectedItem = e.NewItems[0]; 
        } 
 
Regards, 
Jai Ganesh S 


Bernd
Replied On December 9, 2016 05:54 AM

Hi Jai,

thank you for pointing out a direction. I have to see how I can make use of this because I do modifiy SelectedItems within my handler and this could lead to an infinite recursion so I could either disable/reenable the nofitication while processing it or I have to rewrite my code.

The reason I am modifing SelectedItems is because I want to support selection of groups (both collapsed and expanded) with automatically including all contained subgroups or items.

However, you can consider this issue as resolved.

Regards
Bernd

Gobikrishnan Murugesan [Syncfusion]
Replied On December 11, 2016 11:58 PM

Hi Bernd,  
 
Thank you for the update.  
 
Please let us know if you need further assistance on this.  
 
Regards,  
Gobikrishnan 


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.

;