[英]How can I scale a UIElement in C#?
I have defined a canvas in XAML that I add a lot of figures to in C#. 我已经在XAML中定义了一个画布,并在C#中添加了很多图形。 I've got some pinch going on but need some help applying the scale to the
UIElement
. 我正在捏一些东西,但需要一些将比例应用于
UIElement
帮助。
I've created my ScaleTransform
like this: 我创建了这样的
ScaleTransform
:
ScaleTransform scaleTrans = new ScaleTransform();
scaleTrans.ScaleX = scaleFactor;
scaleTrans.ScaleY = scaleFactor;
But how can I apply it to my UIElement
(the only children of my canvas)? 但是如何将其应用于
UIElement
(画布的唯一子项)?
您需要使用UIElement.RenderTransform属性:
yourElement.RenderTransform = scaleTrans;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.