矩形内的堆栈面板
是否可以在矩形内添加堆栈面板。我需要一个带有圆角的自定义 wpf 窗口。对我来说实现它的最佳方法是将矩形内容添加到窗口中并使窗口的背景透明。现在我需要两个堆栈面板,但如何将其放置在矩形内?
Is it possible to add a stackpanel inside a rectangle. I need a custom wpf window that has rounded corners. Best way to achieve it for me was to add a rectangle content into a window and make window's background transparent. Now I need two stackpanels but how can I place it inside a rectangle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
边框
控件而不是矩形
,边框可以包含内容,在您的情况下是Stackpanel
。另一种可能性是使用
Grid
,将 Rectangle 和 Stackpanel 放入同一单元格中:
use a
Border
control instead of aRectangle
, a Border can have content, theStackpanel
in your case.Another possibility would be to use a
Grid
, where you put the Rectangle and the Stackpanel into the same cell: