private void SelectionManager(EO.Wpf.TreeViewItem treeViewItem, bool isRightClick = true) { PeriodName period; if (treeViewItem.Header.ToString() == defaultValue.name) { period = null; treeViewItem.Focus(); } else { period = this.Root.GetChildByName(treeViewItem.Header.ToString()) as PeriodName; if (!CtrlPressed) { if (!isRightClick || (isRightClick && !selectedItems.ContainsKey(treeViewItem) && !selectedPeriodNames.Keys.Contains(period))) { removeCTRLSelection(); selectedItems.Add(treeViewItem, null); SetSelectedItem(treeViewItem); selectedPeriodNames.Add(period, period.GetPosition()); } } else if (CtrlPressed && !selectedItems.ContainsKey(treeViewItem) && !selectedPeriodNames.Keys.Contains(period)) { selectedItems.Add(treeViewItem, null); selectedPeriodNames.Add(period, period.GetPosition()); SetSelectedItem(treeViewItem); } } }
private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { EO.Wpf.TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject); if (treeViewItem != null) { treeViewItem.Focus(); e.Handled = true; } else { PeriodInterval period = GetSelectedPeriodInterval(); //if (period != null) period.IsSelected = false; periodTreeview.Focus(); } }
/// <summary> /// Cette methode permet la selection du noeud présent derrière la souris /// lorsque fait un click-droit. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { EO.Wpf.TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject); if (treeViewItem != null) { treeViewItem.Focus(); e.Handled = true; } else { BGroup group = GetSelectedGroup(); if (group != null) { group.IsSelected = false; } tree.Focus(); } }
/// <summary> /// Cette methode permet la selection du noeud présent derrière la souris /// lorsque fait un click-droit. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { EO.Wpf.TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject); if (treeViewItem != null) { treeViewItem.Focus(); e.Handled = true; } else { Kernel.Domain.Measure measure = GetSelectedMeasure(); if (measure != null) { measure.IsSelected = false; } tree.Focus(); } }
/// <summary> /// Cette methode permet la selection du noeud présent derrière la souris /// lorsque fait un click-droit. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { EO.Wpf.TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject); if (treeViewItem != null) { treeViewItem.Focus(); SelectionManager(treeViewItem); e.Handled = true; } else { PeriodName period = GetSelectedPeriod(); if (period != null) { period.IsSelected = false; } tree.Focus(); removeCTRLSelection(); } }