本文整理汇总了C#中System.Windows.Documents.Adorner类的典型用法代码示例。如果您正苦于以下问题:C# Adorner类的具体用法?C# Adorner怎么用?C# Adorner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Adorner类属于System.Windows.Documents命名空间,在下文中一共展示了Adorner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResizeThumb_DragStarted
private void ResizeThumb_DragStarted(object sender, DragStartedEventArgs e)
{
this.designerItem = this.DataContext as ContentControl;
if (this.designerItem != null)
{
this.canvas = VisualTreeHelper.GetParent(this.designerItem) as ContentPresenter;
if (this.canvas != null)
{
this.transformOrigin = this.designerItem.RenderTransformOrigin;
this.rotateTransform = this.designerItem.RenderTransform as RotateTransform;
if (this.rotateTransform != null)
{
this.angle = this.rotateTransform.Angle * Math.PI / 180.0;
}
else
{
this.angle = 0.0d;
}
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this.canvas);
if (adornerLayer != null)
{
this.adorner = new SizeAdorner(this.designerItem);
adornerLayer.Add(this.adorner);
}
}
}
}
示例2: item_OnDragStart
private void item_OnDragStart(Adorner adorner)
{
if (OnDragStart != null)
{
OnDragStart(adorner);
}
}
示例3: ShowAdorner
public void ShowAdorner()
{
if (this.adorner == null)
{
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
if (adornerLayer != null)
{
ContentControl element = this.DataContext as ContentControl;
Canvas canvas = VisualTreeHelper.GetParent(element) as Canvas;
this.adorner = new ResizeAdorner(element);
adornerLayer.Add(this.adorner);
if (this.ShowDecorator)
{
this.adorner.Visibility = Visibility.Visible;
}
else
{
this.adorner.Visibility = Visibility.Hidden;
}
}
}
else
{
this.adorner.Visibility = Visibility.Visible;
}
}
示例4: OnLoaded
private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
{
canvas = this.GetVisualChild<Canvas>();
adornerlayer = AdornerLayer.GetAdornerLayer(this);
var designableDragAndResizeChrome = new DesignableResizeChrome(selection);
selectionAdorner = new DesignableResizeAdorner(canvas, selection, designableDragAndResizeChrome);
}
示例5: AssertTemplatedAdornerTypee
private static void AssertTemplatedAdornerTypee(Adorner adorner, [CallerMemberName] string caller = null)
{
if (adorner?.GetType() != TemplatedAdornerType)
{
throw new InvalidOperationException($"{caller} can only be called on {TemplatedAdornerType}");
}
}
示例6: ShowAdorner
private void ShowAdorner()
{
if (this.adorner == null)
{
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
if (adornerLayer != null)
{
ContentControl designerItem = this.DataContext as ContentControl;
Canvas canvas = VisualTreeHelper.GetParent(designerItem) as Canvas;
this.adorner = new ResizeRotateAdorner(designerItem);
adornerLayer.Add(this.adorner);
if (this.ShowDecorator)
{
this.adorner.Visibility = Visibility.Visible;
}
else
{
this.adorner.Visibility = Visibility.Hidden;
}
}
}
else
{
this.adorner.Visibility = Visibility.Visible;
}
}
示例7: ShowAdorner
private void ShowAdorner()
{
if (adorner == null)
{
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
if (adornerLayer != null)
{
ContentControl designerItem = this.DataContext as ContentControl;
Canvas canvas = Algorithm.FindVisualParent<Canvas>(designerItem);
adorner = new DesignerItemAdorner(designerItem,new ResizeRotateControl());
adornerLayer.Add(adorner);
if (ShowDecorator)
{
adorner.Visibility = Visibility.Visible;
}
else
{
adorner.Visibility = Visibility.Collapsed;
}
}
}
else
{
adorner.Visibility = Visibility.Visible;
}
}
示例8: item_OnDragStop
private void item_OnDragStop(Adorner adorner)
{
if (OnDragStop != null)
{
OnDragStop(adorner);
}
}
示例9: AdorneredTooltip
public AdorneredTooltip(Adorner adorner, bool adornerLayerVisible)
{
Argument.IsNotNull(() => adorner);
_adornerLayerVisible = adornerLayerVisible;
_adorner = adorner;
_visible = _adorner.Visibility == Visibility.Visible;
}
示例10: Add
public void Add(FrameworkElement parentControl, Adorner tooltip, bool adornerLayerVisibility)
{
if (!Contains(parentControl))
{
CreateAdornersList(parentControl);
}
GetAdorners(parentControl).Add(_factory.Create(tooltip, adornerLayerVisibility));
}
示例11: ResizeDecorator_Unloaded
private void ResizeDecorator_Unloaded(object sender, RoutedEventArgs e)
{
if (_adorner != null)
{
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
if (adornerLayer != null)
adornerLayer.Remove(_adorner);
_adorner = null;
}
}
示例12: ResizeThumb_DragCompleted
private void ResizeThumb_DragCompleted(object sender, DragCompletedEventArgs e)
{
if (adorner != null)
{
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this.canvas);
if (adornerLayer != null)
{
adornerLayer.Remove(this.adorner);
}
adorner = null;
}
}
示例13: DesignerItemDecorator_Unloaded
private void DesignerItemDecorator_Unloaded(object sender, RoutedEventArgs e)
{
if (this.adorner != null)
{
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
if (adornerLayer != null)
{
adornerLayer.Remove(this.adorner);
}
this.adorner = null;
}
}
示例14: dc_PropertyChanged
void dc_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "LeftPictureLocation")
{
var doesThisWork = VisualTreeHelper.GetChild(leftItemsControl, 0);
var doesThisWorkt = VisualTreeHelper.GetChild(doesThisWork, 0);
var doesThisWorktt = VisualTreeHelper.GetChild(doesThisWorkt, 0);
canvasToTouch = (Canvas)doesThisWorktt;
myAdornerLayer = AdornerLayer.GetAdornerLayer((Visual)doesThisWorktt);
ad = new SimpleCircleAdorner((UIElement)doesThisWorktt);
myAdornerLayer.Add(ad);
myAdornerLayer.IsHitTestVisible = false;
}
}
示例15: Show
private static void Show(Adorner adorner, bool retry)
{
var adornerLayer = AdornerLayer.GetAdornerLayer(adorner.AdornedElement);
if (adornerLayer != null)
{
////Debug.WriteLine(nameof(Show));
adornerLayer.Remove(adorner);
adornerLayer.Add(adorner);
}
else if (retry)
{
// try again later, perhaps giving layout a chance to create the adorner layer
adorner.Dispatcher.BeginInvoke(
DispatcherPriority.Loaded,
new DispatcherOperationCallback(ShowAdornerOperation),
new object[] { adorner });
}
}