Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/wpfdesigner@5883 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
4 changed files with 162 additions and 9 deletions
@ -0,0 +1,38 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <author name="Kumar Devvrat"/>
|
||||||
|
// <version>$Revision: $</version>
|
||||||
|
// </file>
|
||||||
|
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 |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Display height of the element.
|
||||||
|
/// </summary>
|
||||||
|
class HeightDisplay : Control |
||||||
|
{ |
||||||
|
static HeightDisplay() |
||||||
|
{ |
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(HeightDisplay), new FrameworkPropertyMetadata(typeof(HeightDisplay))); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Display width of the element.
|
||||||
|
/// </summary>
|
||||||
|
class WidthDisplay : Control |
||||||
|
{ |
||||||
|
static WidthDisplay() |
||||||
|
{ |
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(WidthDisplay), new FrameworkPropertyMetadata(typeof(WidthDisplay))); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,48 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <author name="Kumar Devvrat"/>
|
||||||
|
// <version>$Revision: $</version>
|
||||||
|
// </file>
|
||||||
|
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 |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Display Height/Width on the primary selection
|
||||||
|
/// </summary>
|
||||||
|
[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); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue