本文整理汇总了C#中System.Windows.Controls.UIElement.TransformToAncestor方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.TransformToAncestor方法的具体用法?C# UIElement.TransformToAncestor怎么用?C# UIElement.TransformToAncestor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.UIElement
的用法示例。
在下文中一共展示了UIElement.TransformToAncestor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateElementAdorners
/// <summary>
/// Update the Adorners for the given element
/// </summary>
/// <param name="element">UIElement for which we're updating AdornerSet</param>
private void UpdateElementAdorners(UIElement element)
{
Size size;
// we intentionally do not ascend in to a 3D scene
Visual adornerLayerParent = VisualTreeHelper.GetParent(this) as Visual;
if (adornerLayerParent == null)
{
return;
}
Debug.Assert(element != null);
ArrayList adornerInfos = ElementMap[element] as ArrayList;
if (adornerInfos == null)
{
return;
}
bool dirty = false;
//
// See if the adorners need to be rerendered due to object resizing
//
GeneralTransform transform = element.TransformToAncestor(adornerLayerParent);
for (int i = 0; i < adornerInfos.Count; i++)
{
AdornerInfo adornerInfo = (AdornerInfo)adornerInfos[i];
size = element.RenderSize;
Geometry clip = null;
bool clipChanged = false;
if (adornerInfo.Adorner.IsClipEnabled)
{
clip = GetClipGeometry(adornerInfo.Adorner.AdornedElement, adornerInfo.Adorner);
if (adornerInfo.Clip == null && clip != null || adornerInfo.Clip != null && clip == null ||
(adornerInfo.Clip != null && clip != null && adornerInfo.Clip.Bounds != clip.Bounds))
{
clipChanged = true;
}
}
if (adornerInfo.Adorner.NeedsUpdate(adornerInfo.RenderSize) || adornerInfo.Transform == null ||
transform.AffineTransform == null || adornerInfo.Transform.AffineTransform == null ||
transform.AffineTransform.Value != adornerInfo.Transform.AffineTransform.Value ||
clipChanged)
{
InvalidateAdorner(adornerInfo);
adornerInfo.RenderSize = size;
adornerInfo.Transform = transform;
if (adornerInfo.Adorner.IsClipEnabled)
{
adornerInfo.Clip = clip;
}
dirty = true;
}
}
if (dirty)
InvalidateMeasure();
}