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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SelectedItem not highlighted when datagrid is filtered

Thread ID:





149215 Nov 19,2019 09:09 AM UTC Nov 20,2019 01:51 PM UTC WPF 1
Tags: SfDataGrid
Asked On November 19, 2019 09:09 AM UTC


I have a Syncfusion.UI.Xaml.Grid.SfDataGrid ( with SelectedItem="{Binding CurrentTask}" and ItemSource="{Binding Source={StaticResource TaskViewSource}}" set in XAML.

In code-behind, when something changes to the CurrentTask, I first save the ID of the CurrentTask in CurrentTaskID and save the modified task to the context. Then I reload the ItemSource (by doing TaskViewSource.Source = Context.Tasks.Local and TaskViewSource.View.Refresh() ), and reset CurrentTask to the task previously selected (CurrentTask = DataContext.Find(CurrentTaskI).First() ).

However, after doing this on a filtered DataGrid, the SelectedItem is not highlighted anymore. On the other hand, when doing this on a non-filtered DataGrid it is working fine.

What can I do to solve this?


Gowtham Gopalsamy [Syncfusion]
Replied On November 20, 2019 01:51 PM UTC

Hi Koen, 
Thank you for using Syncfusion controls. 
We have analyzed your query to highlight the selected items after resetting the datasource. You can highlight the same selected items in another new datasource and you have the same record in both datasource .Otherwise, you can use the SelectedIndex to highlight the  selectedItem another new datasource. 
Please refer the below code snippet, 
var CurrentTask = this.dataGrid.ResolveToRowIndex(index); 
this.dataGrid.SelectedIndex = CurrentTask; 
Please refer the sample in below link, 
Please refer the UG link in below, 
Please let us know, if you require further assistance on this. 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon