<syncfusion:GridTreeControl x:Name="_tree"AutoPopulateColumns="False"AllowDrop="False"AllowSort="False"ChildPropertyName="Children"EnableHotRowMarker="False"EnableNodeSelection="True"UpdateMode="PropertyChanged"ItemsSource="{Binding FHIRModelNodes}"NotifyPropertyChanges="True"VisualStyle="Metro"syncfusion:LayoutControl.SetMetroMode="True"ExpandGlyphType="PlusMinusLines"SupportNodeImages="True"Width="490" AllowAutoSizingNodeColumn="False"ExpandStateAtStartUp="AllNodesExpanded">
I need to be able too delete the selected node (the GridTree is set to single row selection). I'm not sure if I am doing this correctly, the way I delete the node is directly from the viewmodel. This nearly works the problem is that as I have deleted the "selected node" the control the makes another node selected.
Although this appears to work and the intended node is selected, I end up with two nodes selected (even though the control is set to single row selection). I guess I must be doing it wrong._myGridTree.SelectedNode =_theNodeIwant;
treeGrid.InternalGrid.SelectedNodes.Clear(); |
var viewModel = this.treeGrid.DataContext as ViewModel; if (treeGrid.SelectedNodes.Count == 0) return;
var node = treeGrid.SelectedNodes[0]; viewModel.PersonDetails.Remove(node.Item as PersonInfo); foreach(var person in viewModel.PersonDetails) { person.Children.Remove(node.Item as PersonInfo); } |
treeGrid.InternalGrid.SelectedNodes.Clear(); |