Hello,
I have a delegate command that moves a node up or down. I want the item to be active after reordering in order to use the keyboard arrow keys to navigate through the other items. How can i achieve that? I tried to bind the ActiveDataItem property in the XamDataTree with my ActiveItem property in the VM but with no result.
public DelegateCommand<object> MoveUpCommand { get; set; }
MoveUpCommand = new DelegateCommand<object>(OnMoveUp, CanMoveUp);
public NodeItem ActiveItem { get; set; }
private void OnMoveUp(object obj) { var item = obj as NodeItem; var index = Nodes.IndexOf(item); Nodes.Move(index, index+ 1); ActiveItem = item; } private bool CanMoveUp(object obj) { var item = obj as ActiveItem; return Nodes.IndexOf(item) != 0; }
I've just did a quick test re-ordering two items and then setting one of them as an active and it seems to be working. Could you take a look at the sample project I was using and modify it so it illustrate the issue that you're seeing or provide a sample of your own.
I'm basically re-ordering the third and forth node at the root level and activating the one that is going up and doing this at a button click an it all seem to be behaving as expected.
Hope this helps.