递归应用转换的 WPF 容器
我有一个由许多控件(例如按钮和其他自定义控件)组成的用户控件。
UserControl 还负责与控件交互的各种动画。
现在,我想倒置或侧向使用我的控件。有没有一种方法可以将所有内容放入容器中,然后简单地旋转容器,以便控件所做的所有内容都像以前一样工作,但旋转了(即递归应用旋转变换)?
目前它位于网格中。
编辑:另外,是否也可以将所有控件对齐在一起?目前它们都对齐到中底部。您将所有控件的对齐方式设置为多少,以便您可以更改容器的对齐方式,并且它们都将类似地对齐。
I have a UserControl that is composed of many controls such as Buttons and other custom controls.
The UserControl takes care of various animations that interact with the controls as well.
Now, I'd like to use my control upside down, or sideways. Is there a way to put everything into a container, and simply rotate the container, so that everything that the control did works as before, but rotated (i.e. the rotate transformation is applied recursively)?
Currently it is in a Grid.
EDIT: Also, is it possible to have all the controls align together as well? Currently they all align to middle bottom. What would you set the alignment of all controls to so that you could change the alignment of the container and they would all align similarly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
设置容器的 RenderTransform 或 LayoutTransform 将为您完成此操作。哪一个取决于您的需求——可以在这里找到关于差异的简短而甜蜜的解释:
http://www.scottlogic.co.uk/blog/colin/2008/12/layouttransform-vs-rendertransform-whats-the-difference/
我不确定这个的 xaml,但在 C# 中它很简单:
Setting the
RenderTransform
orLayoutTransform
of the container will do this for you. Which one depends on your needs -- a short and sweet explanation of the difference can be found here:http://www.scottlogic.co.uk/blog/colin/2008/12/layouttransform-vs-rendertransform-whats-the-difference/
I'm not sure the xaml for this, but in C# it's as simple as: