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

RadTreeListView with Checkbox, Multiple selection and not CanUserSelect

10 Answers 252 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 1
Erik asked on 12 May 2011, 10:11 AM

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

Sort by
0
Vanya Pavlova
Telerik team
answered on 12 May 2011, 10:19 AM
Hi Erik,

 

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.


Best wishes,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Erik
Top achievements
Rank 1
answered on 12 May 2011, 11:52 AM

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

0
Vanya Pavlova
Telerik team
answered on 12 May 2011, 12:09 PM
Hello 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. 


Regards,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Vanya Pavlova
Telerik team
answered on 12 May 2011, 12:10 PM
Hello 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 to manipulate the selection programmatically as described in our online documentation. 


Regards,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Erik
Top achievements
Rank 1
answered on 23 May 2011, 12:56 PM
Hi,

Now I have written a

CustomKeyboardCommandProvider

but when I do

commandsToExecute.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
0
Vanya Pavlova
Telerik team
answered on 23 May 2011, 01:07 PM
Hi 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.  



Best wishes,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Erik
Top achievements
Rank 1
answered on 23 May 2011, 01:30 PM
Hi,

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;

        }

 

0
Erik
Top achievements
Rank 1
answered on 23 May 2011, 02:10 PM

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.

0
Tsvyatko
Telerik team
answered on 23 May 2011, 04:02 PM
Hi Erik,

 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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Erik
Top achievements
Rank 1
answered on 24 May 2011, 01:48 PM
Thank you for the sample!
/Erik

 

Tags
TreeListView
Asked by
Erik
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Erik
Top achievements
Rank 1
Tsvyatko
Telerik team
Share this question
or