如何在wpf画布控件中添加动态设计的用户控件时获取高度和宽度?

发布于 2024-12-29 10:59:05 字数 150 浏览 1 评论 0原文

您好,我正在开发一个 wpf 应用程序。我正在画布中添加 myUserControl 对象。我需要高度和添加的用户控制。现在的问题是用户控件是动态设计的,我正在创建网格并根据用户配置添加行和列,并且我在高度和宽度上给出自动。所以我在画布中添加用户控件时没有获得用户控件的实际高度和宽度。

Hello I am developing one wpf application. I am adding object of myUserControl in canvas. i need height and with of added usercontrol. Now problem is that user control is design dynamically, i am creating grid and adding row and column according to configured by user, and i am giving auto in height and width. so i am not getting actual height and width of user control while adding it in canvas.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

北城半夏 2025-01-05 10:59:05

FrameworkElement 派生的所有 UI 元素都具有 ActualWidthActualHeight 属性。

All UI elements derived from FrameworkElement have the ActualWidth and ActualHeight properties.

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