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 d0fd7e1fd7..c04f6e83b2 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml @@ -329,16 +329,16 @@ - + @@ -349,9 +349,9 @@ - + + + diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/SizeDisplay.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/SizeDisplay.cs new file mode 100644 index 0000000000..7e6984805e --- /dev/null +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/SizeDisplay.cs @@ -0,0 +1,38 @@ +// +// +// +// +// $Revision: $ +// +using System; +using System.Diagnostics; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; + +namespace ICSharpCode.WpfDesign.Designer.Controls +{ + /// + /// Display height of the element. + /// + class HeightDisplay : Control + { + static HeightDisplay() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(HeightDisplay), new FrameworkPropertyMetadata(typeof(HeightDisplay))); + } + } + + /// + /// Display width of the element. + /// + class WidthDisplay : Control + { + static WidthDisplay() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(WidthDisplay), new FrameworkPropertyMetadata(typeof(WidthDisplay))); + } + } +} \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SizeDisplayExtension.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SizeDisplayExtension.cs new file mode 100644 index 0000000000..de1a41a007 --- /dev/null +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SizeDisplayExtension.cs @@ -0,0 +1,48 @@ +// +// +// +// +// $Revision: $ +// +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.ComponentModel; +using ICSharpCode.WpfDesign.Adorners; +using ICSharpCode.WpfDesign.Extensions; +using ICSharpCode.WpfDesign.Designer.Controls; +namespace ICSharpCode.WpfDesign.Designer.Extensions +{ + /// + /// Display Height/Width on the primary selection + /// + [ExtensionFor(typeof(UIElement))] + class SizeDisplayExtension : PrimarySelectionAdornerProvider + { + HeightDisplay heightDisplay; + WidthDisplay widthDisplay; + protected override void OnInitialized() + { + base.OnInitialized(); + if (this.ExtendedItem != null) + { + RelativePlacement placementHeight = new RelativePlacement(HorizontalAlignment.Right, VerticalAlignment.Stretch); + placementHeight.XOffset = 10; + heightDisplay = new HeightDisplay(); + heightDisplay.DataContext = this.ExtendedItem.Component; + + RelativePlacement placementWidth = new RelativePlacement(HorizontalAlignment.Stretch, VerticalAlignment.Bottom); + placementWidth.YOffset = 10; + widthDisplay = new WidthDisplay(); + widthDisplay.DataContext = this.ExtendedItem.Component; + + this.AddAdorners(placementHeight, heightDisplay); + this.AddAdorners(placementWidth, widthDisplay); + } + } + } +} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj index b6d4bfb068..6e82103add 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj @@ -99,6 +99,7 @@ + @@ -119,6 +120,7 @@ + Code