将 Polygon 的高度绑定到 StackPanel 的高度
我不知道如何将多边形的高度绑定到堆栈面板的高度。
如果我想添加一个矩形,我所要做的就是这样:
<Rectangle Width="75" >
<Rectangle.Fill>
<SolidColorBrush Color="Red" />
</Rectangle.Fill>
</Rectangle>
这个矩形不会限制面板的高度。但对于多边形,我似乎无法将某些点保留为空白,以便与父面板一起缩放。
谢谢
I can't figure how to bind the height of a polygon to the height of my stack panel.
If I wanted to add a rectangle, all I had to do is something like that:
<Rectangle Width="75" >
<Rectangle.Fill>
<SolidColorBrush Color="Red" />
</Rectangle.Fill>
</Rectangle>
This one won't brake the height of the panel. but with the polygon it seems like I can't leave some of the points as blank so that will scale with the parent panel.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
用
包裹多边形。Viewbox
自动将其内容缩放到其大小。具体如何操作可以使用Stretch
和StretchDirection
属性进行调整。Wrap your polygon with a
<Viewbox>
.The
Viewbox
automatically scales its content to its size. Exactly how it does so can be tweaked with theStretch
andStretchDirection
properties.这个解决方案也有效
this solution works too