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

GridView keyboard navigation with groups and row details

1 Answer 99 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Arthur
Top achievements
Rank 1
Arthur asked on 24 Jul 2014, 07:50 AM
Hi,

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?

Thanks

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 28 Jul 2014, 08:11 AM
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)
           {
               commandsToExecute.Clear();
 
               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.

Regards,
Yoan
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.
 
Tags
GridView
Asked by
Arthur
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or