Everything works perfectly except this line: <SetterProperty="Background"Value="CornflowerBlue"/>
So, how can I set the background color of a selected row?
3 Answers, 1 is accepted
answered on 11 Apr 2013, 08:11 AM
If you want to modify the appearance of the selected row, you can predefine its template using Microsoft Expression Blend. There you should modify the Border element named Background_Selected in the way you need. I can suggest you to check this help article for a reference.
In my scenario, I don't want to change the default style or a default color of the selected row. But in certain conditions, I would like to change the selection color of the specific row.
For example from the SelectionChanged event handler of RadGridView, if a certain condition occurs, I would like to highlight the selected row (or rows) in a different color.
The problem is that there is no such property like:
myGrid.SelectedItem.Background = Brushes.Red (and I want this to happen only for this specific time, and not always)
I hope you can help me,
Thanks in advance
answered on 23 Nov 2015, 11:49 AM
You can achieve your goal, by using a RowStyleSelector. Please check this help article for a reference. In your case, you can add a property of the business object (for example "IsActive") which will control when the row will switch its color. Then in the selection changed event, after some custom logic, you can set the IsActive property to True and the row should change its color.
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items