12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- ///////////////////////////////////////////////////////////////////////////////
- //Copyright (c) 2016, 北京探索者软件公司
- //All rights reserved.
- //文件名称: MaskAdorner.cs
- //文件描述: MaskAdorner.cs
- //创 建 者: xls
- //创建日期: 2018/5/31 9:26:35
- //版 本 号:1.0.0.0
- ////////////////////////////////////////////////////////////////////////////////
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- namespace FWindSoft.Wpf.Controls
- {
- public sealed class MaskAdorner:Adorner
- {
- private Control m_Child;
-
- public MaskAdorner(UIElement uiElement,ControlTemplate template) : base(uiElement)
- {
- this.m_Child = new Control
- {
- DataContext = uiElement,
- IsTabStop = false,
- Template = template,
- //IsHitTestVisible = false,
- };
- base.AddVisualChild(this.m_Child);
-
- }
- protected override Visual GetVisualChild(int index)
- {
- return m_Child??null;
- }
- protected override int VisualChildrenCount
- {
- get
- {
- if (m_Child == null)
- return 0;
- return 1;
- }
- }
-
- protected override Size MeasureOverride(Size availableSize)
- {
- // return AdornedElement.DesiredSize;
- return base.MeasureOverride(availableSize);
- }
- protected override Size ArrangeOverride(Size finalSize)
- {
- this.m_Child.Arrange(new Rect(new Point(0, 0), finalSize));
- return base.ArrangeOverride(finalSize);
- }
-
- }
- }
|