WindowsAppSDK: Content doesn't fill the entire screen when using FullScreenPresenter at a first time after app start
Describe the bug
When I execute at a first time
_appWindow.SetPresenter(AppWindowPresenterKind.FullScreen);
There’s two white thick borders on the Window at the bottom and the right sides. Bottom one looks like a Taskbar-size and the right one looks like a scrollbar-size.
When I restore Presenter to Default
and then go Full Screen again, everything seems to be fine.
Steps to reproduce the bug
- Create Blank App, packaged (WinUI 3 Desktop)
- Create a
Button
on non-white-backgroundedGrid
- Fill the
Click
event handler usingAppWindow.SetPresenter
(sample code below) - Run: Unpackaged, x64, Debug (other configurations didn’t tested)
- Click the button
Result
The app went to full screen mode. Window’s content doesn’t fill the entire screen.
Expected behavior
There’re no borders. Window
content fills the full screen.
Screenshots
Preview image on a full screen, it’s clickable. White borders on a white back are invisible (in case you’re using a light GitHub theme).
NuGet package version
1.0.0
Packaging type
Unpackaged
Windows version
October 2020 Update (19042)
IDE
Visual Studio 2022
Additional context
Reproducibility: 100%
Sample code, only changes to default template.
MainWindow.xaml
<Grid Background="CadetBlue" BorderBrush="Red" BorderThickness="2">
<Button x:Name="myButton" Click="myButton_Click" HorizontalAlignment="Center">Full Screen</Button>
</Grid>
MainWindow.xaml.cs
public sealed partial class MainWindow : Window
{
private AppWindow _appWindow;
public MainWindow()
{
this.InitializeComponent();
_appWindow = GetAppWindowForCurrentWindow();
}
private void myButton_Click(object sender, RoutedEventArgs e)
{
if (_appWindow.Presenter.Kind == AppWindowPresenterKind.FullScreen)
{
_appWindow.SetPresenter(AppWindowPresenterKind.Default);
myButton.Content = "Full Screen";
}
else
{
_appWindow.SetPresenter(AppWindowPresenterKind.FullScreen);
myButton.Content = "Exit Full Screen";
}
}
private AppWindow GetAppWindowForCurrentWindow()
{
IntPtr hWnd = WindowNative.GetWindowHandle(this);
WindowId myWndId = Win32Interop.GetWindowIdFromWindow(hWnd);
return AppWindow.GetFromWindowId(myWndId);
}
}
There’s no workaround found yet.
Also my default Windows theme is Light. If i set explicitly add RequestedTheme = ApplicationTheme.Dark;
in the App
ctor, the bug stops reproducing.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 16 (4 by maintainers)
Tracked by http://task.ms/37197163
We’ve filed a bug internally to track this and it’s been assigned to the dev team for investigation.
Different root causes for those bugs, this particular one is fixed now, just not when you’re maximized and thus hitting #2577. 😃 I see your point, but we track them separately and should close them as they get fixed and serviced.
If we want to track them as a “hey bug 1, 2, and 3 all need to be fixed before the entire feature works end-to-end with no hiccups/gotchas” we should create an item that these all links up to for that purpose, but we’ll continue to close the individual bugs as the root cause for them gets fixed and serviced (I assume you don’t want us to hold back releasing a fix just because another related issue is not fixed yet).
1.1 did not release. 1.0.1 did.
Ok I found a simple (albeit bizarre) workaround. Everyone confronting this problem knows that it only happens the first time you set the presenter. So, set a flag, and the first time, surround your call to SetPresenter with a toggle for extending content into the title bar.
ah, I had the exact same problem.
My workaround is running this after
InitializeComponent
It’s a stupid workaround, but I couldn’t find another way.