Files
BrightSharp.Toolkit/BrightSharp/Diagrams/Adorners/ResizeRotateAdorner.cs
2017-02-18 00:15:59 +03:00

50 lines
1.2 KiB
C#

using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
namespace Diagrams
{
[ToolboxItem(false)]
public class ResizeRotateAdorner : Adorner
{
private VisualCollection visuals;
private ResizeRotateChrome chrome;
protected override int VisualChildrenCount
{
get
{
return this.visuals.Count;
}
}
public ResizeRotateAdorner(ContentControl designerItem)
: base(designerItem)
{
SnapsToDevicePixels = true;
this.chrome = new ResizeRotateChrome();
this.chrome.DataContext = designerItem;
this.visuals = new VisualCollection(this);
this.visuals.Add(this.chrome);
this.Focusable = true;
}
protected override Size ArrangeOverride(Size arrangeBounds)
{
this.chrome.Arrange(new Rect(arrangeBounds));
return arrangeBounds;
}
protected override Visual GetVisualChild(int index)
{
return this.visuals[index];
}
}
}