How to show GridView focus

9 posts, 1 answers
  1. Antti
    Antti avatar
    23 posts
    Member since:
    May 2011

    Posted 26 Sep 2011 Link to this post

    Hello,

    Is there a way to style GridView so that it would show focus somehow? Currently when we have more than one grid on one page, all the grids look similar even though only one of them has focus.

     

    What I mean is that the grid template, row template and cell template would have something like FocusVisualStyle applied when focus is in the grid in question. Is it possible to simulate this behavior somehow?

    Regards, Antti

  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 26 Sep 2011 Link to this post

    Hello Antti,

     

    You may try to handle RadGridView's GotFocus event and there you may alter its appearance in an appropriate manner:

    private void radGridView1_GotFocus(object sender, System.Windows.RoutedEventArgs e)
          {
              var grid = e.OriginalSource as GridViewDataControl;
              if (grid != null)
              {
                  grid.BorderThickness = new System.Windows.Thickness(4);
                  grid.BorderBrush = new SolidColorBrush(Colors.Red);
              }
          }


    Once the Focus of RadGridView is lost you may return these settings to the initial values. 
    Please let me how this works for you!


    Kind regards,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Antti
    Antti avatar
    23 posts
    Member since:
    May 2011

    Posted 28 Sep 2011 Link to this post

    Thank you for the quick answer Vanya!

    So, may I conclude that there is no built-in support for this kind of behavior through styling (=visual states)?

    Can the method that you mentioned be used to alter the appearance of the rows or the cells?

    Regards,
    Antti
  4. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 28 Sep 2011 Link to this post

    Hi Antti,

     

    You may use Expression Blend for that purpose and to predefine the templates of GridViewCell/GridViewRow.  In our online documentation you will find a detailed information about RadGridView's styling and its parts, following this link. 



    Best wishes,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Antti
    Antti avatar
    23 posts
    Member since:
    May 2011

    Posted 28 Sep 2011 Link to this post

    Hi,

    I know how to edit styles and templates, but my problem is that there doen't seem to exist support for the states I would need in the RadGridVIew. There is no mention of the term "focus" on the page that you recommended.

    There is the state FocusStates/Focused in the GridViewRow's template, but that only seems define the row that is selected first. What I would need is the kind of behavior that states DATAGRIDROW_stateSelected and DATAGRIDROW_stateSelectedFocused make possible in the SL Toolkit DataGrid. The behavior that I'm after goes like this: 1) multiple rows are selected (they become orange), 2) focus is transferred away from the GridView (rows change to gray as they are still selected but not focused anymore), 3) focus is returned to GridView (rows become orange again as they are now selected and focused). Is this possible with RadGridVIew?
  6. Answer
    Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 30 Sep 2011 Link to this post

    Hello Antti,

     

    With the current implementation of RadGridView you cannot achieve this result out of the box.
    Even from the UX point of view GridViewRow does not implement such State combination in the same way as it is implemented in DataGridRow. Indeed your request is reasonable and we will consider such a request when we discuss our future development plans. For the time being I cannot give you an estimated release date. It could be great if you share your thoughts about which states do you want to use in RadGridView/Silverlight. 




    Regards,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  7. Antti
    Antti avatar
    23 posts
    Member since:
    May 2011

    Posted 03 Oct 2011 Link to this post

    Thank you for the answer Vanya!

    Here I try to describe what I would like to have:
    • Possibility to style rows and cells differently depending on if the grid is for full row or cell selection
      • This would require that the selection mode would be accessible from the row and cell templates
      • Concrete example would be that I would like to hide the current cell border when in full row mode
    • Possibility to style row differently when normal/selected/focused
      • Change current FocusStates names to something else as this is not what focus in SL means
      • To SelectionStates in addition to Unselected and Selected add SelectedFocused
      • Consider adding UnselectedFocused, MouseOverSelected and MouseOverSelectedFocused
    • Possibility to style cell differently when normal/selected/focused
      • To CommonStates add CurrentFocused and MouseOverFocused
      • To SelectionStates add SelectedFocused and consider UnselectedFocused

    Regards,
    Antti
  8. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 03 Oct 2011 Link to this post

    Hi Antti,

     


    Thank you for getting back to us! I would like to share some thoughts about some of the issues listed above:


    1. The RadGridView's SelectionUnit property is used to determine whether the user can select either a cell or a row. Furthermore the appearance of a selected cell and row is separated - you have a Border  named Background_Selected in both templates and you may change it in an appropriate manner.  


    2. Regarding the issue with the Border around the current cell you may always hide it through predefining the template of GridViewCell and removing the Background_Current Border and its corresponding state. 
    Once you have marked this style as an implicit one it will be applied correspondingly. 
    In our online documentation you will find help article on this topic, you may find it here. 


    For the rest we will definitely take into account your requests when we consider our future development plans.   



    Once again thank you for your time and involvement! 


    Greetings,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  9. Antti
    Antti avatar
    23 posts
    Member since:
    May 2011

    Posted 03 Oct 2011 Link to this post

    Hi,

    Just a small refinement to my suggestions. I know that it is possible to style cells and rows accordingly for full row/cell selection with two different styles-one for each mode. What I would like to do, would be to have only one style that could adapt itself to the selection mode. This would mean that cell and row styles would have to be able to know the SelectionUnit. Maybe this is possible in SL5 and ancestor binding, but currently I don't think this is achievable.

    Regards, Antti
Back to Top