如何在 Silverlight 中拉伸控件以填充画布?
我需要做的就是拉伸控件以填充整个画布。 我想我必须使用画布(我不希望我的控件被剪裁 当在容器外部渲染时 - 据我所知所有其他容器 执行裁剪 - 网格、边框... - 也许还有另一种解决方案?)
如果我将控件放在 Canvas 内,它就可以正常工作(我的意思是它没有被裁剪)。 然而,它并没有填满整个画布。 我试图绑定到画布的宽度和高度 - 但没有结果。
您有什么想法或线索吗?
提前致谢!
What I need to do is to stretch the control to fill entire Canvas.
I think I have to use a Canvas (I don't want my control to be clipped
when rendered outside the container - as far as I know all the other containers
perform clipping - Grid, Border... - maybe there is another solution?)
If I put the control inside Canvas it works fine (I mean it is not clipped).
However, it doesn't fill entire Canvas.
I was trying to bind to the Canvas width and height - with no results.
Do you have any ideas or clues?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
控件可以通过负边距来逃避容器,例如
Border
或Grid
。因此,也许您应该重新使用Grid
并使用列和行定义进行布局,并在需要的地方使用负边距。A control can escape the container such as a
Border
or aGrid
by having negative margins. So perhaps you should return to using aGrid
and play around with placement using column and row definitions and using negative margins where you need them.