【WPF】ActualWidth、ActualHeightを確実に取得する
// http://csfun.blog49.fc2.com/blog-entry-41.html
public void Test()
{
InitializeComponent();
// InitializeComponentの処理が終了した時点ではレイアウトシステムがまだ処理を
// 完了していないため、Dispatcher.BeginInvokeでAucualHogeHogeをセットするようにする。
Dispatcher.BeginInvoke(
() =>
{
Canvas.SetTop(imageButton, 5);
Canvas.SetLeft(imageButton, LayoutRoot.ActualWidth - 25);
}
);
}