Hi,
I want the user to be able to navigate through the tree and actively select one or several nodes by the use of the keboard.
I have tried the all kinds of different options on the RadTreeListView. Added the GridViewSelectColumn, set the SelectionMode to Extended, set the CanUserSelect to false.
When I try to navigate with the keyboard I get unexpected behaviour.
What settings should I use?
Best regards
Erik
10 Answers, 1 is accepted
By default the end user can select only a single item since the SelectionMode property of RadTreeListView is set to Single. If you set this property to Extended you will be able to the Shift + Up / Down arrows to select multiple rows. In any other case you need to predefine the default behavior of these keyboards you may create your custom keyboard command provider, as demonstrated in the following blog post.
Vanya Pavlova
the Telerik team

Hi,
To simplify the problem, only by setting the property CanUserSelect="False" I can not navigate the tree with the keyboard. The first row witch is selected by default I can expand, but no other nodes.
/Erik
This behavior is by design. When you set the RadTreeListView's CanUserSelect Property to False you disable the selection to the end-user. However it is still possible the manipulate the selection programmatically as described in our online documentation.
Vanya Pavlova
the Telerik team
This behavior is by design. When you set the RadTreeListView's CanUserSelect Property to False you disable the selection to the end-user. However it is still possible to manipulate the selection programmatically as described in our online documentation.
Vanya Pavlova
the Telerik team

Now I have written a
CustomKeyboardCommandProvider
but when I docommandsToExecute.Add(
RadGridViewCommands.ExpandHierarchyItem);
it expands the node that is selected and not the node that is the CurrentItem.
Can you show me an example on how to naivigate the WPF RadTreeListView using the keyboard.
Best regards
Erik
You may use the Up / Down / Left / Right arrows to navigate in RadTreeListView. If you need to predefine the default keyboard navigation you should create your own custom keyboard command provider, as demonstrated in the following online help article. Then you can easily manipulate this behavior in an appropriate for your custom needs manner.
Please give it a try and let me know if you have any further inqueries.
Vanya Pavlova
the Telerik team

That is what I have done. It doesn’t work!
public override IEnumerable<ICommand> ProvideCommandsForKey(Key key)
{
List<ICommand> commandsToExecute = base.ProvideCommandsForKey(key).ToList();
ObservableCollection<WarehouseItem> list = ((ObservableCollection<WarehouseItem>)this.parentGrid.ItemsSource);
if (key == Key.Up)
{
commandsToExecute.Clear();
commandsToExecute.Add(RadGridViewCommands.MoveUp);
}
else if (key == Key.Down)
{
commandsToExecute.Clear();
commandsToExecute.Add(RadGridViewCommands.MoveDown);
}
else if (key == Key.Right)
{
commandsToExecute.Clear();
commandsToExecute.Add(RadGridViewCommands.ExpandHierarchyItem);
commandsToExecute.Add(RadGridViewCommands.MoveRight);
}
else if (key == Key.Left)
{
commandsToExecute.Clear();
commandsToExecute.Add(RadGridViewCommands.CollapseHierarchyItem);
commandsToExecute.Add(RadGridViewCommands.MoveLeft);
}
else if (key == Key.Space)
{
commandsToExecute.Clear();
commandsToExecute.Add(RadGridViewCommands.SelectCurrentUnit);
}
return commandsToExecute;
}

I want multiple (extended) select so I changed the code for the SPACE key:
else if (key == Key.Space)
{
commandsToExecute.Clear();
if (parentGrid.CurrentItem != null)
{
if (parentGrid.SelectedItems.Contains(parentGrid.CurrentItem))
parentGrid.SelectedItems.Remove(parentGrid.CurrentItem);
else
parentGrid.SelectedItems.Add(parentGrid.CurrentItem);
}
}
but it only works if I press with the mouse in the checkbox first.
I have prepared sample application that enables the desired behavior. Please, have a look at the attachment and let us know if you have any further questions or issues.
Kind regards,Tsvyatko
the Telerik team

/Erik