wp7 页面方向

    public partial class Page1 : PhoneApplicationPage
    {
        public Page1()
        {
            InitializeComponent();
            this.SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape; // 这句话很重要
            OrientationChanged += new EventHandler<OrientationChangedEventArgs>(Page1_OrientationChanged);

        }

     

      // 改变屏幕事件

      void Page1_OrientationChanged(object sender, OrientationChangedEventArgs e)
        {
            if (e.Orientation == PageOrientation.LandscapeLeft
               || e.Orientation == PageOrientation.LandscapeRight)
            {
                TitlePanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                TitlePanel.Visibility = Visibility.Visible;
            }
        }
    }

posted @ 2012-03-24 21:17  walleyekneel  阅读(160)  评论(0编辑  收藏  举报