GridView keyboard navigation with groups and row details

2 posts, 0 answers
  1. Arthur
    Arthur avatar
    7 posts
    Member since:
    May 2014

    Posted 24 Jul 2014 Link to this post


    I have a requirement here to support ALL operations that are possible with mouse also with keyboard.
    This means that the user must be able to expand all things by keyboard only.

    Now I have groups in the grid view and under the groups there are rows with cells from the GridViewToggleRowDetailsColumn.
    So the groups are expandable/collapseable and the rows also.

    My question is: How can I navigate to the the toggle buttons of the group header and the row details column to toggle them by keyboard only?

    I have subclassed already the DefaultKeyboardCommandProvider to get more control over the navigation commands. But the commands just leave out the group headers and the GridViewToggleRowDetailsColumn is leaved out while the previous row is in edit mode and a TAB key is pressed (MoveNext command is executed). 

    I need a tab stop on both kinds of toggle buttons. What is the best way to achieve this?

  2. Yoan
    Yoan avatar
    1215 posts

    Posted 28 Jul 2014 Link to this post

    Hello Arthur,

    In order to achieve your goal, you can use GridView's GetRowForItem method and the DetailsVisibility property of GridViewRow. Please check the following code snippet for a reference:
    public override IEnumerable<ICommand> ProvideCommandsForKey(Key key)
               List<ICommand> commandsToExecute = base.ProvideCommandsForKey(key).ToList();
               if (key == Key.Space)
                   var itemToExpand = this.parentGrid.GetRowForItem(this.parentGrid.SelectedItem);
                   if (itemToExpand != null)
                       itemToExpand.DetailsVisibility = itemToExpand.DetailsVisibility.GetValueOrDefault(Visibility.Collapsed) == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
               return commandsToExecute;

    Please give it a try and let me know how it works for you.

    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.
Back to Top