简体   繁体   English

如何在wpf canvas控件中添加动态设计的用户控件的高度和宽度?

[英]How to get height and width of dynamically designed user control while added in wpf canvas control?

Hello I am developing one wpf application. 您好我正在开发一个wpf应用程序。 I am adding object of myUserControl in canvas. 我在画布中添加了myUserControl的对象。 i need height and with of added usercontrol. 我需要高度和添加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. 现在的问题是用户控件是动态设计的,我创建网格并根据用户的配置添加行和列,并且我在高度和宽度上给出auto。 so i am not getting actual height and width of user control while adding it in canvas. 所以我在画布中添加它时没有获得用户控件的实际高度和宽度。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM