예제 #1
0
		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();
			}
		}
예제 #2
0
		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();
		}
예제 #3
0
파일: Viewport2D.cs 프로젝트: donllen/DDD
        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();
        }