I would like to make my application such that it can maximize to full screen means it hide the windows task bar and the title bar as well. And it should triggered by a butto
If the taskbar doesn't disappear, it may help to change the Window visibility before and after changing window style, like this:
private void MainWindow_StateChanged(object sender, EventArgs e) {
if (this.WindowState == WindowState.Maximized) {
// hide the window before changing window style
this.Visibility = Visibility.Collapsed;
this.Topmost = true;
this.WindowStyle = WindowStyle.None;
this.ResizeMode = ResizeMode.NoResize;
// re-show the window after changing style
this.Visibility = Visibility.Visible;
}
else {
this.Topmost = false;
this.WindowStyle = WindowStyle.SingleBorderWindow;
this.ResizeMode = ResizeMode.CanResize;
}
}