WPF如何获取控件大小
比如<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<ScrollViewer>
<StackPanel>
<Canvas Background="AliceBlue" />
</StackPanel>
</ScrollViewer>
</Window>
如何获取Canvas的大小,这只是简单例子,我是说如果在父控件和子控件都是用比如StackPanel进行的布局该如何找到他们的大小,Code用Height,Width,ActualHeight, ActualWidth 这样的属性得到的是NaN和0.0,没有办法获取。