如何使我的WPF应用程序全屏

时间:2017-01-15 15:40:08

标签: wpf wpf-controls taskbar

我一直在构建一个包含媒体播放器的小型WPF应用程序。我几乎完成了除了一部分,让播放器全屏。我已经明白了我隐藏了Windows任务栏的位置,并且播放器覆盖了所有内容,除了任务栏的位置。所以播放器是全屏的,除了任务栏通常所在的位置,你只看到桌面背景的一部分。

private void Full_Click(object sender, RoutedEventArgs e)
{
    this.WindowStyle = WindowStyle.None;
    this.ResizeMode = ResizeMode.NoResize;
    this.WindowState = WindowState.Maximized;
    Taskbar.Hide();
    player.Stretch = Stretch.Fill;
    controlPanel.Visibility = Visibility.Collapsed;//hides media controls
    player.Height = System.Windows.SystemParameters.PrimaryScreenHeight + 200;//I tried to set the height to fill the entire screen
    Full.Visibility = Visibility.Hidden;//hides full screen control           //Im aware that may be too large of an increase but I
    CloseFull.Visibility = Visibility.Visible;//shows exit control            //wanted to see if it would work at all

}

1 个答案:

答案 0 :(得分:4)

为什么要隐藏任务栏?

这应该足够了:

you might lose the data, are you sure you want to continue?