private void UpdateMultipleSelection(TreeNodeSelectionState state) { // Uno specific - in case the OnApplyTemplate was not yet called // the multiselect checkbox is not yet set - we must cache the selection and call this again if (m_selectionBox == null) { return; } switch (state) { case TreeNodeSelectionState.Selected: m_selectionBox.IsChecked = true; break; case TreeNodeSelectionState.PartialSelected: m_selectionBox.IsChecked = null; break; case TreeNodeSelectionState.UnSelected: m_selectionBox.IsChecked = false; break; } UpdateTreeViewItemVisualState(state); }
internal void UpdateSelectionVisual(TreeNodeSelectionState state) { var treeView = AncestorTreeView; if (treeView != null) { var listControl = treeView.ListControl; if (listControl.IsMultiselect) { UpdateMultipleSelection(state); } else { var node = TreeNode; if (node != null) { var viewModel = listControl.ListViewModel; var isNodeSelected = viewModel.IsNodeSelected(node); if (isNodeSelected != IsSelected) { IsSelected = isNodeSelected; } } } } }
private void UpdateTreeViewItemVisualState(TreeNodeSelectionState state) { if (state == TreeNodeSelectionState.Selected) { VisualStateManager.GoToState(this, "TreeViewMultiSelectEnabledSelected", false); } else { VisualStateManager.GoToState(this, "TreeViewMultiSelectEnabledUnselected", false); } }
private void UpdateSelection(TreeViewNode node, TreeNodeSelectionState state) { if (node.SelectionState != state) { var viewModel = m_viewModel; if (viewModel != null) { viewModel.UpdateSelection(node, state); viewModel.NotifyContainerOfSelectionChange(node, state); } } }
internal void SelectByIndex(int index, TreeNodeSelectionState state) { try { BeginSelectionChanges(); var targetNode = GetNodeAt(index); UpdateSelection(targetNode, state); } finally { EndSelectionChanges(); } }