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

Highlight SelectedItem

3 Answers 634 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Maurizio
Top achievements
Rank 2
Maurizio asked on 29 Oct 2014, 11:28 AM
How can I make a RadGrid to always highlight the SelectedItem (or CurrentItem) in full color like in the screen-shot OK.png.

Why does the SelectedItem ist sometimes only have a border like in the other screen-shot (NotOK.png).

I want a behavior like in a ListBox where some item is always "active" (i.e. selected).

3 Answers, 1 is accepted

Sort by
0
Maurizio
Top achievements
Rank 2
answered on 29 Oct 2014, 11:32 AM
The attached Screenshots were bad, here are the right ones.

Unfortunately I cannot edit my old post
Paul
Top achievements
Rank 2
Iron
Iron
Iron
commented on 08 Dec 2021, 11:00 AM

I have the same problem when I set the property that CurrentItem is bound to (MVVM).
The grid row does not get highlighted (as if clicked on) but instead gets a hard to see rectangle around it.
(EnableLostFocusSelectedState does not work as it hasn't lost focus)

Is there a property I need on the xaml to tell it to highlight the row the same as if clicked on when changed via code?

 

 

 

 

Martin Ivanov
Telerik team
commented on 09 Dec 2021, 12:19 PM

By default the IsSynchronizedWithCurrentItem property of RadGridView is set to null. This means that the selection will be synchronized with the current item only if the ItemsSource of RadGridView is a CollectionView object. To achieve your requirement, you can try setting the IsSynchronizedWithCurrentItem property to True.
Paul
Top achievements
Rank 2
Iron
Iron
Iron
commented on 09 Dec 2021, 12:28 PM

I already have that set and it is not highlighting the row the same as when I click it.
Martin Ivanov
Telerik team
commented on 09 Dec 2021, 12:34 PM

This probably means that the grid has lost the focus at that moment. The selection in RadGridView has two visual states - one for the case when the control is focused and another for the case when it is not. When the gridview is focused, the selected row gets a color based on the specific theme, and when unfocused, the row usually uses a gray color variation. To disable the unfocused selected state, you can set the EnableLostFocusSelectedState property to False.

If this doesn't work as you mentioned previously, I would recommend you to upload a project showing the issue.

Paul
Top achievements
Rank 2
Iron
Iron
Iron
commented on 09 Dec 2021, 12:59 PM | edited

Setting EnableLostFocusSelectedState to False is working for me now. I also set IsTabStop="False" on the RadDataPager. 
0
Accepted
Boris
Telerik team
answered on 30 Oct 2014, 04:12 PM
Hi Peter,

It might be just a shot in the dark but could you try setting the EnableLostFocusSelectedState property of RadGridView to "False". For more information about this property you can check the Stop Showing the Unfocused State documentation article. However, if that is not helping, could you please provide us with more information about your case? Perhaps some code snippets with how everything is defined and a screen-cast that will illustrate the steps to reproduce the behavior.

We are looking forward to your reply.

Regards,
Boris Penev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Maurizio
Top achievements
Rank 2
answered on 04 Nov 2014, 05:23 PM
Good shot, Boris!

It did the trick. My current row remains nicely highlighted - wherever the focus moves.
Tags
GridView
Asked by
Maurizio
Top achievements
Rank 2
Answers by
Maurizio
Top achievements
Rank 2
Boris
Telerik team
Share this question
or