treeGrid.PreviewKeyDown += treeGrid_PreviewKeyDown;
void treeGrid_PreviewKeyDown(object sender, KeyEventArgs e)
{
var node = this.treeGrid.SelectedNode as GridTreeNode;
if (node == null)
return;
if (node.ParentNode == null && e.Key == Key.Right)
{
treeGrid.InternalGrid.ExpandNode(node);
e.Handled = true;
}
else if (node.ParentNode == null && e.Key == Key.Left)
{
treeGrid.InternalGrid.CollapseNode(node);
}
treeGrid.InternalGrid.ResetDisplay();
} |
Thank you, if you have a few levels of nodes, rather than checking ParentNode is there a HasChildren or similar property?