开发者

WPF Container That Applies Transformations Recursively

I have a UserControl that is composed开发者_如何学Go 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.


Setting the RenderTransform or LayoutTransform 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:

grid.RenderTransform = new RotateTransform(90);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜