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 FilterBindings(VisualTreeItem node) { foreach (var child in node.Children) { if (child.HasBindingError) { VisualTreeItems.Add(child); } else { FilterBindings(child); } } }
private void FilterTree(VisualTreeItem node, string localFilter) { foreach (var child in node.Children) { if (child.Filter(localFilter)) { VisualTreeItems.Add(child); } else { FilterTree(child, localFilter); } } }
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; }