private void OnPlotterChildrenChanged(object sender, NotifyCollectionChangedEventArgs e) { bool updateVisible = false; if (e.NewItems != null) { foreach (IPlotterElement item in e.NewItems) { if (Viewport2D.GetIsContentBoundsHost(plotter.VisualBindings[item])) { DebugVerify.Is(!contentBoundsHosts.Contains(item)); updateVisible = true; contentBoundsHosts.Add(item); } } } if (e.OldItems != null) { foreach (IPlotterElement item in e.OldItems) { if (contentBoundsHosts.Contains(item)) { updateVisible = true; contentBoundsHosts.Remove(item); } } } if (updateVisible && IsFittedToView) { UpdateVisible(); } }
private void UpdateContentBoundsHosts() { contentBoundsHosts.Clear(); foreach (var item in plotter.Children) { DependencyObject dependencyObject = item as DependencyObject; if (dependencyObject != null) { bool isContentBoundsHost = Viewport2D.GetIsContentBoundsHost(dependencyObject); if (isContentBoundsHost) { contentBoundsHosts.Add(item); } } } UpdateVisible(); }
private void UpdateContentBoundsHosts() { contentBoundsHosts.Clear(); foreach (var item in plotter.Children) { DependencyObject dependencyObject = item as DependencyObject; if (dependencyObject != null) { bool hasNonEmptyBounds = !Viewport2D.GetContentBounds(dependencyObject).IsEmpty; if (hasNonEmptyBounds && Viewport2D.GetIsContentBoundsHost(dependencyObject)) { contentBoundsHosts.Add(dependencyObject); } } } UpdateVisible(); }