本文整理汇总了C#中UIElement.InternalSetTransformWorkaround方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.InternalSetTransformWorkaround方法的具体用法?C# UIElement.InternalSetTransformWorkaround怎么用?C# UIElement.InternalSetTransformWorkaround使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIElement
的用法示例。
在下文中一共展示了UIElement.InternalSetTransformWorkaround方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InternalSetLayoutTransform
/// <summary>
/// NOTE: THIS METHOD IS ONLY FOR INTERNAL SPECIFIC USE. It does not support some features of FrameworkElement,
/// for example RenderTarnsfromOrigin and LayoutTransform.
///
/// This is the method layout parent uses to set a location of the child
/// relative to parent's visual as a result of layout. Typically, this is called
/// by the parent inside of its ArrangeOverride implementation. The transform passed into
/// this method does not get combined with offset that is set by SetLayoutOffset, but rahter resets
/// LayoutOffset to (0,0). Typically, layout parents use offset most of the time and only need to use this method instead if they need to introduce
/// a non-trivial transform (including rotation or scale) between them and a layout child.
/// DO NOT name this SetLayoutTransform()! The Xaml Compile may be fooled into thinking LayoutTransform is an attached property.
/// </summary>
/// <param name="element">The element on which to set a transform.</param>
/// <param name="layoutTransform">The final transform of this element relative to its parent's visual.</param>
internal static void InternalSetLayoutTransform(UIElement element, Transform layoutTransform)
{
FrameworkElement fe = element as FrameworkElement;
element.InternalSetOffsetWorkaround(new Vector());
Transform additionalTransform = (fe == null ? null : fe.GetFlowDirectionTransform()); //rtl
Transform renderTransform = element.RenderTransform;
if(renderTransform == Transform.Identity)
renderTransform = null;
// Create a TransformCollection and make sure it does not participate
// in the InheritanceContext treeness because it is internal operation only.
TransformCollection ts = new TransformCollection();
ts.CanBeInheritanceContext = false;
if(additionalTransform != null)
ts.Add(additionalTransform);
if(renderTransform != null)
ts.Add(renderTransform);
ts.Add(layoutTransform);
TransformGroup group = new TransformGroup();
group.Children = ts;
element.InternalSetTransformWorkaround(group);
}
示例2: InternalSetLayoutTransform
internal static void InternalSetLayoutTransform(UIElement element, Transform layoutTransform)
{
FrameworkElement frameworkElement = element as FrameworkElement;
element.InternalSetOffsetWorkaround(new Vector());
Transform transform1 = frameworkElement == null ? (Transform) null : frameworkElement.GetFlowDirectionTransform();
Transform transform2 = element.RenderTransform;
if (transform2 == Transform.Identity)
transform2 = (Transform) null;
TransformCollection transformCollection = new TransformCollection();
transformCollection.CanBeInheritanceContext = false;
if (transform1 != null)
transformCollection.Add(transform1);
if (transform2 != null)
transformCollection.Add(transform2);
transformCollection.Add(layoutTransform);
element.InternalSetTransformWorkaround((Transform) new TransformGroup()
{
Children = transformCollection
});
}