xamlファイルで作成した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#とメトロ開発者で、iOSと比較してすべての動作が混乱しています。
「OnNavigatedTo(NavigationEventArgs e)」でチェックします。これが問題になるのだろうか? –
は 'Loaded'イベントハンドラで試行し、' ActualHeight'は正しい番号を返します –