How to remove title bar on xamarin wpf and make the application full screen?
Behavior of xamarin wpf full screen is different from original wpf application. When i enable the full screen mode by
ResizeMode="NoResize", WindowState="Normal", WindowStyle="None", Topmost="True", WindowState = "Maximized";
The application is not actually remove the titlebar and hide the taskbar.
Is there any way to achieve same behavior as native WPF application ?
That's how I removed all the bars create by Xamarin.Forms (tested in v3.2):
Add the remove method:
private bool topBarsRemoved = false; private void RemoveTopBars() { System.Windows.Controls.Grid commandBar = this.Template.FindName("PART_CommandsBar", this) as System.Windows.Controls.Grid; if (commandBar != null) (commandBar.Parent as System.Windows.Controls.Grid)?.Children.Remove(commandBar); var topAppBar = this.Template.FindName("PART_TopAppBar", this) as WpfLightToolkit.Controls.LightAppBar; if (topAppBar != null) (topAppBar.Parent as System.Windows.Controls.Grid)?.Children.Remove(topAppBar); topBarsRemoved = true; }
Call the method:
protected override void OnActivated(EventArgs e) { base.OnActivated(e); if (!topBarsRemoved) RemoveTopBars(); }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.