Thank you, if you have a few levels of nodes, rather than checking ParentNode is there a HasChildren or similar property?
Sorry found what I needed, here's my code for other people:
private void treeGrid_OnPreviewKeyDown(object sender, KeyEventArgs e)
{
var node = this.treeGrid.SelectedNode as GridTreeNode;
if (node == null)
return;
if (node.HasChildNodes && e.Key == Key.Right)
{
treeGrid.InternalGrid.ExpandNode(node);
e.Handled = true;
}
else if (node.HasChildNodes && e.Key == Key.Left)
{
treeGrid.InternalGrid.CollapseNode(node);
e.Handled = true;
}
else if (e.Key == Key.Right || e.Key == Key.Left)
{
e.Handled = true;
}
treeGrid.InternalGrid.ResetDisplay();
}