diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml index c38dff1ff7..861ae7e58b 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml @@ -1,416 +1,412 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ZoomControl.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ZoomControl.cs index 659c6e3738..e9cd9f2b36 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ZoomControl.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ZoomControl.cs @@ -22,8 +22,8 @@ namespace ICSharpCode.WpfDesign.Designer.Controls { static ZoomControl() { - DefaultStyleKeyProperty.OverrideMetadata(typeof(ZoomControl), - new FrameworkPropertyMetadata(typeof(ZoomControl))); + DefaultStyleKeyProperty.OverrideMetadata(typeof(ZoomControl), + new FrameworkPropertyMetadata(typeof(ZoomControl))); PanToolCursor = new Cursor(GetStream("Images/PanToolCursor.cur")); PanToolCursorMouseDown = new Cursor(GetStream("Images/PanToolCursorMouseDown.cur")); @@ -43,25 +43,25 @@ namespace ICSharpCode.WpfDesign.Designer.Controls public static double Minimum = 0.1; public static double Maximum = 10; - double startHorizontalOffset; - double startVericalOffset; + double startHorizontalOffset; + double startVericalOffset; internal ScrollViewer ScrollViewer; - Border container; + FrameworkElement container; ScaleTransform transform; - Point startPoint; - bool isMouseDown; - bool pan; + Point startPoint; + bool isMouseDown; + bool pan; - public static readonly DependencyProperty ZoomProperty = - DependencyProperty.Register("Zoom", typeof(double), typeof(ZoomControl), - new PropertyMetadata(1.0, null, CoerceZoom)); + public static readonly DependencyProperty ZoomProperty = + DependencyProperty.Register("Zoom", typeof(double), typeof(ZoomControl), + new PropertyMetadata(1.0, null, CoerceZoom)); - public double Zoom - { - get { return (double)GetValue(ZoomProperty); } - set { SetValue(ZoomProperty, value); } - } + public double Zoom + { + get { return (double)GetValue(ZoomProperty); } + set { SetValue(ZoomProperty, value); } + } static object CoerceZoom(DependencyObject d, object baseValue) { @@ -74,7 +74,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls base.OnApplyTemplate(); ScrollViewer = (ScrollViewer)Template.FindName("scrollViewer", this); - container = (Border)Template.FindName("container", this); + container = (FrameworkElement)Template.FindName("container", this); transform = new ScaleTransform(); container.LayoutTransform = transform; @@ -87,114 +87,114 @@ namespace ICSharpCode.WpfDesign.Designer.Controls uxReset.Click += delegate { Reset(); }; } - protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) - { - base.OnPropertyChanged(e); - if (e.Property == ZoomProperty) - { + protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) + { + base.OnPropertyChanged(e); + if (e.Property == ZoomProperty) + { transform.ScaleX = Zoom; transform.ScaleY = Zoom; - CenterViewport((double)e.OldValue); - } - } - - protected override void OnKeyDown(KeyEventArgs e) - { - if (!pan && e.Key == Key.Space) - { - Cursor = PanToolCursor; - pan = true; - } - } - - protected override void OnKeyUp(KeyEventArgs e) - { - if (e.Key == Key.Space) - { - ClearValue(CursorProperty); - pan = false; - } - } - - protected override void OnPreviewMouseDown(MouseButtonEventArgs e) - { - if (pan) - { + CenterViewport((double)e.OldValue); + } + } + + protected override void OnKeyDown(KeyEventArgs e) + { + if (!pan && e.Key == Key.Space) + { + Cursor = PanToolCursor; + pan = true; + } + } + + protected override void OnKeyUp(KeyEventArgs e) + { + if (e.Key == Key.Space) + { + ClearValue(CursorProperty); + pan = false; + } + } + + protected override void OnPreviewMouseDown(MouseButtonEventArgs e) + { + if (pan) + { Cursor = PanToolCursorMouseDown; - Mouse.Capture(this); // will call move - isMouseDown = true; - startPoint = e.GetPosition(this); - PanStart(); - } - } - - protected override void OnPreviewMouseMove(MouseEventArgs e) - { - if (isMouseDown && pan) - { - var endPoint = e.GetPosition(this); - PanContinue(endPoint - startPoint); - } - } - - protected override void OnPreviewMouseUp(MouseButtonEventArgs e) - { - if (isMouseDown) - { + Mouse.Capture(this); // will call move + isMouseDown = true; + startPoint = e.GetPosition(this); + PanStart(); + } + } + + protected override void OnPreviewMouseMove(MouseEventArgs e) + { + if (isMouseDown && pan) + { + var endPoint = e.GetPosition(this); + PanContinue(endPoint - startPoint); + } + } + + protected override void OnPreviewMouseUp(MouseButtonEventArgs e) + { + if (isMouseDown) + { Cursor = PanToolCursor; - isMouseDown = false; - Mouse.Capture(null); - } - } + isMouseDown = false; + Mouse.Capture(null); + } + } protected override void OnMouseEnter(MouseEventArgs e) { Focus(); } - public void Fit() - { - Zoom = Math.Min( - ScrollViewer.ActualWidth / container.ActualWidth, - ScrollViewer.ActualHeight / container.ActualHeight); - } + public void Fit() + { + Zoom = Math.Min( + ScrollViewer.ActualWidth / container.ActualWidth, + ScrollViewer.ActualHeight / container.ActualHeight); + } public void ZoomIn() - { + { Zoom *= ZoomFactor; } public void ZoomOut() - { + { Zoom /= ZoomFactor; } - public void Reset() - { - Zoom = 1; - ScrollViewer.ScrollToHorizontalOffset(0); - ScrollViewer.ScrollToVerticalOffset(0); - } - - void PanStart() - { - startHorizontalOffset = ScrollViewer.HorizontalOffset; - startVericalOffset = ScrollViewer.VerticalOffset; - } - - void PanContinue(Vector delta) - { - ScrollViewer.ScrollToHorizontalOffset(startHorizontalOffset - delta.X); - ScrollViewer.ScrollToVerticalOffset(startVericalOffset - delta.Y); - } - - void CenterViewport(double oldZoom) - { - var k = Zoom / oldZoom; - var add = (k * ScrollViewer.ViewportWidth - ScrollViewer.ViewportWidth) / 2; - ScrollViewer.ScrollToHorizontalOffset(k * ScrollViewer.HorizontalOffset + add); - add = (k * ScrollViewer.ViewportHeight - ScrollViewer.ViewportHeight) / 2; - ScrollViewer.ScrollToVerticalOffset(k * ScrollViewer.VerticalOffset + add); - } + public void Reset() + { + Zoom = 1; + ScrollViewer.ScrollToHorizontalOffset(0); + ScrollViewer.ScrollToVerticalOffset(0); + } + + void PanStart() + { + startHorizontalOffset = ScrollViewer.HorizontalOffset; + startVericalOffset = ScrollViewer.VerticalOffset; + } + + void PanContinue(Vector delta) + { + ScrollViewer.ScrollToHorizontalOffset(startHorizontalOffset - delta.X); + ScrollViewer.ScrollToVerticalOffset(startVericalOffset - delta.Y); + } + + void CenterViewport(double oldZoom) + { + var k = Zoom / oldZoom; + var add = (k * ScrollViewer.ViewportWidth - ScrollViewer.ViewportWidth) / 2; + ScrollViewer.ScrollToHorizontalOffset(k * ScrollViewer.HorizontalOffset + add); + add = (k * ScrollViewer.ViewportHeight - ScrollViewer.ViewportHeight) / 2; + ScrollViewer.ScrollToVerticalOffset(k * ScrollViewer.VerticalOffset + add); + } } } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs index ded6791a92..922e359e91 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs @@ -141,8 +141,6 @@ namespace ICSharpCode.WpfDesign.Designer public DesignPanel() { this.Focusable = true; - this.VerticalAlignment = VerticalAlignment.Top; - this.HorizontalAlignment = HorizontalAlignment.Left; this.AllowDrop = true; DesignerProperties.SetIsInDesignMode(this, true); diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml index 0fe0ad99df..58c2d3e71f 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml @@ -5,11 +5,9 @@ xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls" DataContext="{x:Null}" Background="#888"> - - - - - - - + + + + + diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml index c94ece8ec3..607c19e33a 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml @@ -209,7 +209,7 @@ - @@ -229,10 +229,10 @@ - -