mirror of
https://github.com/VitalickS/BrightSharp.Toolkit.git
synced 2026-03-21 02:21:15 +00:00
45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
|
|
using System.Windows;
|
|||
|
|
using System.Windows.Controls;
|
|||
|
|
using System.Windows.Documents;
|
|||
|
|
using System.Windows.Media;
|
|||
|
|
|
|||
|
|
namespace Diagrams
|
|||
|
|
{
|
|||
|
|
public class SizeAdorner : Adorner
|
|||
|
|
{
|
|||
|
|
private SizeChrome chrome;
|
|||
|
|
private VisualCollection visuals;
|
|||
|
|
private ContentControl designerItem;
|
|||
|
|
|
|||
|
|
protected override int VisualChildrenCount
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return this.visuals.Count;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public SizeAdorner(ContentControl designerItem)
|
|||
|
|
: base(designerItem)
|
|||
|
|
{
|
|||
|
|
this.SnapsToDevicePixels = true;
|
|||
|
|
this.designerItem = designerItem;
|
|||
|
|
this.chrome = new SizeChrome();
|
|||
|
|
this.chrome.DataContext = designerItem;
|
|||
|
|
this.visuals = new VisualCollection(this);
|
|||
|
|
this.visuals.Add(this.chrome);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override Visual GetVisualChild(int index)
|
|||
|
|
{
|
|||
|
|
return this.visuals[index];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override Size ArrangeOverride(Size arrangeBounds)
|
|||
|
|
{
|
|||
|
|
this.chrome.Arrange(new Rect(new Point(0.0, 0.0), arrangeBounds));
|
|||
|
|
return arrangeBounds;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|