Silverlight 全屏與全屏事件

 
  public MainPage()
        {
            InitializeComponent();
            Application.Current.Host.Content.FullScreenChanged += new EventHandler(Content_FullScreenChanged);
        }

        void Content_FullScreenChanged(object sender, EventArgs e)
        {
            if (isFull)
            {
                MessageBox.Show("全屏");
                isFull = false;
            }
            else
            {
                MessageBox.Show("退出全屏");
                isFull = true;
            }
        }
        bool isFull = true;

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            SilverlightHost sh = new SilverlightHost();
            Content content = sh.Content;
            if (isFull)
            {
                content.IsFullScreen = isFull;
            }
            else
            {
                content.IsFullScreen = isFull;
            }
        }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章