示例#1
0
        protected static void OnLayoutPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            FrameworkElement uiElement = d as FrameworkElement;

            if (uiElement != null)
            {
                ViewportPanel panel = VisualTreeHelper.GetParent(uiElement) as ViewportPanel;
                if (panel != null)
                {
                    // invalidating not self arrange, but calling Arrange method of only that uiElement which has changed position
                    panel.InvalidatePosition(uiElement);
                }
            }
        }
示例#2
0
        private void OnPositionChanged(DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue != null)
            {
                PositionChanged.Raise(this, new PositionChangedEventArgs {
                    Position = (Point)e.NewValue, PreviousPosition = (Point)e.OldValue
                });
            }

            if (plotter?.Viewport?.Transform?.DataTransform != null)
            {
                // Bit of a WTF, for some reason I have to apply the transform twice
                Point dataPoint = Position.DataToViewport(plotter.Viewport.Transform);

                ViewportPanel.SetX(this, dataPoint.X);
                ViewportPanel.SetY(this, dataPoint.Y);
            }
        }
 private CoordinateTransform GetTransform(Size size)
 {
     return(viewport.Transform.WithRects(ViewportPanel.GetViewportBounds(this), new Rect(size)));
 }
        private static void OnPlotterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ViewportPanel panel = (ViewportPanel)d;

            panel.OnPlotterChanged((Plotter)e.NewValue, (Plotter)e.OldValue);
        }