atelier:mitsuba

i love UI/UX, Blend, XAML, Behavior, P5, oF, Web, Tangible Bits and Physical computing. なにかあればお気軽にご連絡ください。atelier@c-mitsuba.com

画面サイズを取得する

こんなかんじでデバイスの画像サイズを取得できます。

        private void LayoutRoot_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            string ScreenWidth = Application.Current.Host.Content.ActualWidth.ToString();
            string ScreenHeight = Application.Current.Host.Content.ActualHeight.ToString();

            sizex.Text = ScreenWidth;
            sizey.Text = ScreenHeight;
        }

現存するWP7の画面サイズは480×800なのですが、一応規定サイズとして320×480もあるので、これで取得できます。