This is a migrated thread and some comments may be shown as answers.

Modifying GridViewRowTemplate While Keeping RowStyleSelector

2 Answers 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 15 Mar 2018, 05:08 PM

I've modified the GridViewRowTemplate in order to change the colors of a row when it's selected. But by doing so, I'm unable to use a RowStyleSelector. Anyone have any tips as to how I can keep the functionality of a RowStyleSelector in play while modifying the background color of a selected row? (The background color of a selected row in the Office 2016 template is far too light.)

2 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 20 Mar 2018, 01:29 PM
Hello David,

To change the background of the selected row you can extract and edit the default template of the row. In the extracted template you can change the Background color of a Border with xName="Background_Selected". Then you can based on the custom styles in the selector to the extracted and modify a template. I have created sample project which demonstrates this behavior.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
David
Top achievements
Rank 1
answered on 21 Mar 2018, 03:47 PM

Thanks Dinko. I looked for a couple hours at your solution and mine and they were identical. It was driving me nuts!

Then I noticed that I was basing my StyleSelector on the default RowStyle, not the modified RowStyle. ARGH!!

Thanks for sample tho. It did help in the end.

Tags
GridView
Asked by
David
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
David
Top achievements
Rank 1
Share this question
or