矩形内的堆栈面板

发布于 2025-01-05 03:10:58 字数 101 浏览 3 评论 0原文

是否可以在矩形内添加堆栈面板。我需要一个带有圆角的自定义 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乄_柒ぐ汐 2025-01-12 03:10:58

使用边框 控件而不是 矩形,边框可以包含内容,在您的情况下是 Stackpanel

另一种可能性是使用 Grid,将 Rectangle 和 Stackpanel 放入同一单元格中:

<Grid>
  <Rectangle .../>
  <StackPanel>...</StackPanel>
</Grid>

use a Border control instead of a Rectangle, a Border can have content, the Stackpanel in your case.

Another possibility would be to use a Grid, where you put the Rectangle and the Stackpanel into the same cell:

<Grid>
  <Rectangle .../>
  <StackPanel>...</StackPanel>
</Grid>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文