Select next item with keyboard.

Jul 18, 2013 at 10:34 PM
What I want to achieve is to select the next item in the tree that starts with a specific letter.
For example, when I press 'K' the first expanded item that begins with "K" will be selected.
If I press 'K' again , the selection moves to the next one, etc

Is this possible? I set the IsTextSearchEnabled="True" & TextSearch.TextPath="Name" but to effect. I guess this has to be implemented on top of TreeViewEx.
Jul 19, 2013 at 3:02 PM
I tried to hack my way into it and found it's impossible to catch the KeyDown event on the TreeViewEx control. Also a lot of stuff that's already there -like the SelectNextFromKey() - don't seem to work.
Any ideas?

I am thinking about implement an alternative ISelectionStrategy in order to implement this one and also solve the problems I have with MVVMC.
Jul 20, 2013 at 1:16 AM
Edited Jul 20, 2013 at 1:17 AM
@slompf

Here is little hack to implement the selection by first character.
http://sdrv.ms/1bxqlwE

There is also a new file called SelectionMultipleMVVMC.cs where i'm refactoring the code in order to make it more MVVMC friendly.
I am moving every call to CheckSelectionAllowed and modifications to SelectedItems to a single place, inside ModifySelection(...). All actions coming from user UI must construct a list of items that need to be selected/unselected and call ModifySelection(...) at the end.

You can check the controller in the sample by pressing Ctrl-Z, Ctrl-Y (do/undo selection).
Coordinator
Jul 22, 2013 at 6:04 AM
Hi

I've first checked if the methods next/previous from key are working. They seem to do, because I can navigate the tree with the keys.

But the refactoring looks goog, I am going to integrate it in my code.

For your initial request: yes we cant do it at the moment and yes, where you do it is the right place. But to make it useable for all usecases, we would have to introduce a mechanism, where a treeviewitem model can provide a way to return a search string. Such stuff I would like to introduce in the next version.