/// <summary> /// select a max scene node when a node is selected inside the datagrid /// will only select if track max selection is disabled /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnRowSelected(object sender, MouseButtonEventArgs e) { using (new StopSceneRedraw(false)) { if (!this.KeepSelectedNodes) { return; } DataRow row = sender as DataRow; if (row == null) { return; } NodeView.NodeView viewNode = row.DataContext as NodeView.NodeView; if (viewNode != null) { viewNode.SetNodeSelection(); } // zoom to the current selection if (Settings.Default.ErrorZoomExtends) { AssemblyFunctions.Core.ViewportZoomExtents(true, false); } } }
/// <summary> /// do the actual selection inside the datagrid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SetRowOnThreadIdle(object sender, EventArgs e) { NodeView.NodeView nodeToSelect = this.m_nvCurrent; if (nodeToSelect != null) { this.Dispatcher.BeginInvoke((Action)(() => { this.m_dataGrid.CurrentItem = nodeToSelect; }), DispatcherPriority.Loaded, null); this.Dispatcher.BeginInvoke((Action)(() => { this.m_dataGrid.SelectedItem = nodeToSelect; }), DispatcherPriority.Loaded, null); } ComponentDispatcher.ThreadIdle -= this.SetRowOnThreadIdle; }
/// <summary> /// select one nodeview inside the datagrid /// </summary> /// <param name="node"></param> public void SetRowSelection(NodeView.NodeView node) { if (node == null) { return; } this.m_nvCurrent = node; // this is the same as the winforms on application idle event // the row selection is also done inside the mesh inspection task // via this pattern it will not spam the selection with plenty of selection invokes ComponentDispatcher.ThreadIdle -= this.SetRowOnThreadIdle; ComponentDispatcher.ThreadIdle += this.SetRowOnThreadIdle; }
public ErrorGroup() { this.InitializeComponent(); this.SelectedNode = null; }