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

社会主义新天地 提交于 2019-12-10 14:22:25

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/9033772/how-to-get-height-and-width-of-dynamically-designed-user-control-while-added-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!