mirror of
https://github.com/VitalickS/BrightSharp.Toolkit.git
synced 2026-03-21 18:31:17 +00:00
.net copy
This commit is contained in:
46
BrightSharp.NET/Diagrams/Adorners/SizeAdorner.cs
Normal file
46
BrightSharp.NET/Diagrams/Adorners/SizeAdorner.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class SizeAdorner : Adorner
|
||||
{
|
||||
private SizeChrome chrome;
|
||||
private VisualCollection visuals;
|
||||
private FrameworkElement designerItem;
|
||||
|
||||
protected override int VisualChildrenCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return visuals.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public SizeAdorner(FrameworkElement designerItem)
|
||||
: base(designerItem)
|
||||
{
|
||||
SnapsToDevicePixels = true;
|
||||
this.designerItem = designerItem;
|
||||
chrome = new SizeChrome();
|
||||
chrome.DataContext = designerItem;
|
||||
visuals = new VisualCollection(this);
|
||||
visuals.Add(chrome);
|
||||
}
|
||||
|
||||
protected override Visual GetVisualChild(int index)
|
||||
{
|
||||
return visuals[index];
|
||||
}
|
||||
|
||||
protected override Size ArrangeOverride(Size arrangeBounds)
|
||||
{
|
||||
chrome.Arrange(new Rect(new Point(0.0, 0.0), arrangeBounds));
|
||||
return arrangeBounds;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user