获取WPF控件的电流大小 [英] Getting current size of WPF controls

查看:133
本文介绍了获取WPF控件的电流大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的窗口图像控制。这Image控件的大小设置为自动。

I have Image control in my Window. The size of this Image control is set to "Auto".

<Image x:Name="videoImg" Stretch="Fill" Height="Auto" Width="Auto" />

当我试图让访问,则返回0怎么看这种控制的实际大小?它会调整与窗口。

When i try to get access, it returns 0. How to see real size of this control? It resizes with window.

推荐答案

您可以使用 .ActualHeight .ActualWidth 来得到呈现身高 / 宽度

You can use .ActualHeight and .ActualWidth to get the rendered Height/Width of a control

这篇关于获取WPF控件的电流大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆