private void HandleRefresh(object sender, ExecutedRoutedEventArgs e) { var saveCursor = Mouse.OverrideCursor; Mouse.OverrideCursor = Cursors.Wait; try { var currentTarget = CurrentSelection?.Target; VisualTreeItems.Clear(); Root = VisualTreeItem.Construct(_root, null); if (currentTarget != null) { var visualItem = FindItem(currentTarget); if (visualItem != null) { CurrentSelection = visualItem; } } SetFilter(_filter); } finally { Mouse.OverrideCursor = saveCursor; } }
private void ProcessFilter() { if (SnoopModes.MultipleDispatcherMode && !Dispatcher.CheckAccess()) { Action action = ProcessFilter; Dispatcher.BeginInvoke(action); return; } VisualTreeItems.Clear(); // cplotts todo: we've got to come up with a better way to do this. if (_filter == "Clear any filter applied to the tree view") { SetFilter(string.Empty); } else if (_filter == "Show only visuals with binding errors") { FilterBindings(_rootVisualTreeItem); } else if (_filter.Length == 0) { VisualTreeItems.Add(_rootVisualTreeItem); } else { FilterTree(_rootVisualTreeItem, _filter.ToLower()); } }
private void Load(object localRoot) { _root = localRoot; VisualTreeItems.Clear(); Root = VisualTreeItem.Construct(localRoot, null); CurrentSelection = _rootVisualTreeItem; SetFilter(_filter); OnPropertyChanged(nameof(Root)); }
public void ApplyReduceDepthFilter(VisualTreeItem newRoot) { if (_reducedDepthRoot == newRoot) { return; } if (_reducedDepthRoot == null) { Dispatcher.InvokeAsync(() => { VisualTreeItems.Clear(); VisualTreeItems.Add(_reducedDepthRoot); _reducedDepthRoot = null; }, DispatcherPriority.Background); } _reducedDepthRoot = newRoot; }