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

Unfocused selected cell background color

4 Answers 629 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Piotr
Top achievements
Rank 1
Piotr asked on 11 Sep 2014, 12:19 PM
Hi, 
how can I change background color of cell that is selected and unfocused? It is too bright.
Thanks

4 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 11 Sep 2014, 12:28 PM
Hi Piotr,


Thank you for contacting us.

GridViewCell does not expose SelectedUnfocused state. 

Are you referring to the SelectedUnfocused state of GridViewRow


Regards,
Vanya Pavlova
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Piotr
Top achievements
Rank 1
answered on 11 Sep 2014, 01:30 PM
My problem is as follows:
I am selecting few rows on grid view, then I'm changing some other controls (so the focus is lost), and the background of selected rows is too bright almost distinguishable. 
When I change color of row (by trigger on focus) then a small "border" color is changed, and background color of cell is changed but only a little bit (attachment). The background color of cell is the thing I would like to change.


Maybe there is something like InactiveSelectionHighlightBrushKey in static resources that I could override? There was something like this while using microsoft wpf controls.

0
Accepted
Vanya Pavlova
Telerik team
answered on 11 Sep 2014, 01:55 PM
Hi Piotr,


Thank you for getting back to us. 

The defined Blue Background appears in this way, because the element that hosts the selected unfocused state is over it. Actually this Blue Border is the Background of the row, not of the cell.  
You may reset the selected unfocused state by setting EnableLostFocusSelectedState property of RadGridView to False. 

If you want to keep it and modify its colors, you may alter the entire control template of GridViewRow and change the resources used in this state:

<VisualState x:Name="SelectedUnfocused">
                          <Storyboard>
                              <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="Background_Over"
                                      Storyboard.TargetProperty="(UIElement.Visibility)">
                                  <DiscreteObjectKeyFrame KeyTime="0">
                                      <DiscreteObjectKeyFrame.Value>
                                          <Visibility>Visible</Visibility>
                                      </DiscreteObjectKeyFrame.Value>
                                  </DiscreteObjectKeyFrame>
                              </ObjectAnimationUsingKeyFrames>
                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Over"
                                      Storyboard.TargetProperty="BorderBrush">
                                  <DiscreteObjectKeyFrame KeyTime="0:0:0"
                                          Value="{StaticResource ItemOuterBorder_SelectedUnfocused}" />
                              </ObjectAnimationUsingKeyFrames>
                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundInner_Over"
                                      Storyboard.TargetProperty="Background">
                                  <DiscreteObjectKeyFrame KeyTime="0:0:0"
                                          Value="{StaticResource ItemBackground_SelectedUnfocused}" />
                              </ObjectAnimationUsingKeyFrames>
                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundInner_Over"
                                      Storyboard.TargetProperty="BorderBrush">
                                  <DiscreteObjectKeyFrame KeyTime="0:0:0"
                                          Value="{StaticResource ItemInnerBorder_SelectedUnfocused}" />
                              </ObjectAnimationUsingKeyFrames>
                          </Storyboard>
                      </VisualState>



Regards,
Vanya Pavlova
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Piotr
Top achievements
Rank 1
answered on 12 Sep 2014, 01:42 PM
Thanks, that did the trick :) 
Tags
GridView
Asked by
Piotr
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Piotr
Top achievements
Rank 1
Share this question
or