Setting the selected row color in a Telerik WPF RadGridView

1 Answer 530 Views
DataGrid Styling
Craig
Top achievements
Rank 1
Craig asked on 12 Jul 2021, 07:43 PM

I just used the approach outlined in the link below to set a custom color for the selected row in my RadGridView control.

WPF DataGrid | SelectedBackground and MouseOverBackground | Telerik UI for WPF

This approach seems to have worked just fine for the case when the user clicks on a row to select it.  However, when the SelectedItem property of the grid view is set in code through data binding, the selected row color reverts to the default value.  Only upon clicking the row again does it display using the color that I defined.

Am I missing something?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 13 Jul 2021, 08:05 AM

Hello Craig,

I am sending an example project, could you please look at it?

For further information on the topic look at the following documentation:

WPF DataGrid | Stop Showing the Unfocused State | Telerik UI for WPF

The following code snippet changes the forementioned behavior:

 

<telerik:RadGridView x:Name="RadGridView" ItemsSource="{Binding}" EnableLostFocusSelectedState="False">

 

Regards, Stenly Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Craig
Top achievements
Rank 1
commented on 13 Jul 2021, 01:52 PM

Thanks for the response. Setting the EnableLostFocusSelectedState flag to false fixed the problem.
Tags
DataGrid Styling
Asked by
Craig
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or