如何找到在xaml文件中创建的Canvas
的大小?
例如,我通过以下方式创建了一个Canvas:
<Page
x:Class="MyApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Canvas x:Name="canvas" Background="White">
</Canvas>
</Page>
全屏显示为白色或我指定的画布颜色
在我的类中我尝试过,但没有成功。
double h = canvas.Height; // NaN
h = canvas.ActualHeight; // 0
那么我如何找出画布的实际尺寸?或者尺寸为0,那么如何使画布全屏显示?
我是一名新的C#和Metro开发者,对于与iOS相比的所有工作方式感到困惑。
OnNavigatedTo(NavigationEventArgs e)
进行了检查。这会有问题吗? - Bryan Chen