热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

在XAML中,如何将椭圆保持为圆?-InXAML,howcanIkeepanellipsebeingacircle?

ImgettingXAML-blindImafraid.ImdevelopingaMSSurfaceapplicationandIhaveanellipseins

I'm getting XAML-blind I'm afraid. I'm developing a MS Surface application and I have an ellipse inside a ScatterViewItem (a container an end user can resize). I would like to keep the ellipse a circle (width == height) and keep it as big as possible (the lowest value of width/height of the SVI should be taken for both width/height properties of the ellipse).

我害怕XAML失明。我正在开发一个MS Surface应用程序,我在ScatterViewItem(最终用户可以调整大小的容器)中有一个椭圆。我想保持椭圆为圆(宽度==高度)并保持尽可能大(对于椭圆的宽度/高度属性,应采用SVI宽度/高度的最小值)。

A XAML only solution (using property triggers or similar) is prefered.

优选仅使用XAML解决方案(使用属性触发器或类似方法)。

Your help is much appreciated as always.

一如既往地非常感谢您的帮助。

3 个解决方案

#1


15  

Would a simple Viewbox do the trick? E.g.

一个简单的Viewbox可以解决这个问题吗?例如。


    
        
    

The Viewbox will scale its contents to fill the area of the Viewbox, and by default does the scaling proportionally. The specified horizontal and vertical alignments keep the Ellipse centered when it cannot be stretched to the full size (because of the proportional scaling).

Viewbox将缩放其内容以填充Viewbox的区域,默认情况下按比例缩放。指定的水平和垂直对齐使椭圆在无法拉伸到完整尺寸时保持居中(因为比例缩放)。

#2


30  

I stumbled over this question a few minutes ago and found a much better solution than @Paul Betts (I'd comment on his answer if I could, but I can't)

几分钟前我偶然发现了这个问题并找到了比@Paul Betts更好的解决方案(如果可以,我会评论他的答案,但我不能)

You can simply use to get a circle.

你可以简单地使用 来得到一个圆圈。

Source: http://forums.silverlight.net/t/160615.aspx

资料来源:http://forums.silverlight.net/t/160615.aspx

#3


5  


You could probably get away with not naming this if you did a relative binding as well.

如果你也进行了相对绑定,你可能会因为没有命名而逃脱。


推荐阅读
author-avatar
除了祝福我能怎么办_218
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有