Unfocused selected cell background color

5 posts, 1 answers
  1. Piotr
    Piotr avatar
    5 posts
    Member since:
    Sep 2014

    Posted 11 Sep 2014 Link to this post

    Hi, 
    how can I change background color of cell that is selected and unfocused? It is too bright.
    Thanks

  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 11 Sep 2014 Link to this post

    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.
     
  3. Piotr
    Piotr avatar
    5 posts
    Member since:
    Sep 2014

    Posted 11 Sep 2014 in reply to Vanya Pavlova Link to this post

    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.

  4. Answer
    Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 11 Sep 2014 Link to this post

    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.
     
  5. Piotr
    Piotr avatar
    5 posts
    Member since:
    Sep 2014

    Posted 12 Sep 2014 Link to this post

    Thanks, that did the trick :) 
Back to Top