-
Notifications
You must be signed in to change notification settings - Fork 675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backdrop APIs in 1.3 still require the window to have some content #8416
Labels
Milestone
Comments
Doing it the new way with content before activating the private void CreateAndActivateMainWindow()
{
// Create window and set the title to the app name appended by the executing user.
_mainWindow = new Window() { Title = $"HouseMoney - {Environment.UserName}" };
// Enable desktop acrylic backround if supported.
if (DesktopAcrylicController.IsSupported())
{
_mainWindow.Content = new Microsoft.UI.Xaml.Controls.Grid();
_mainWindow.SystemBackdrop = new DesktopAcrylicBackdrop();
// Create a dispatcher queue controller if required.
/*if (DispatcherQueue.GetForCurrentThread() == null)
{
NativeMethods.DispatcherQueueOptions options;
options.dwSize = (uint)Marshal.SizeOf(typeof(NativeMethods.DispatcherQueueOptions));
options.threadType = NativeMethods.DQTYPE_THREAD_CURRENT;
options.apartmentType = NativeMethods.DQTAT_COM_STA;
NativeMethods.CreateDispatcherQueueController(options, out nint _);
}
// Initial configruation for the system backdrop.
_systemBackdropConfiguration = new SystemBackdropConfiguration() { IsInputActive = true };
switch (Current.RequestedTheme)
{
case ApplicationTheme.Light: _systemBackdropConfiguration.Theme = SystemBackdropTheme.Light; break;
case ApplicationTheme.Dark: _systemBackdropConfiguration.Theme = SystemBackdropTheme.Dark; break;
}
// Hanlde window activation event to set the correct backdrop state.
_mainWindow.Activated += (sender, args) => { if (_systemBackdropConfiguration != null) { _systemBackdropConfiguration.IsInputActive = args.WindowActivationState != WindowActivationState.Deactivated; } };
// On closing the window disconnect the controller and clean up.
_mainWindow.Closed += (sender, args) =>
{
_desktopAcrylicController?.Dispose();
_desktopAcrylicController = null;
_systemBackdropConfiguration = null;
};
// Enable the system backdrop on the main window.
_desktopAcrylicController = new DesktopAcrylicController();
_desktopAcrylicController.AddSystemBackdropTarget(_mainWindow.As<ICompositionSupportsSystemBackdrop>());
_desktopAcrylicController.SetSystemBackdropConfiguration(_systemBackdropConfiguration);*/
}
// Ready for activation.
_mainWindow.Activate();
}
|
How about putting something in Content? m_window.Content = new Grid(); Oh you already tried, sorry. |
bpulliam
added
bug
Something isn't working
team-Rendering
Issue for the Rendering team
fixed-internally
This bug has been fixed, and the fix will be shipped in the next version of WinUI 3.
labels
Apr 20, 2023
bpulliam
added
fixed-in-WinAppSDK1.3
and removed
fixed-internally
This bug has been fixed, and the fix will be shipped in the next version of WinUI 3.
labels
May 9, 2023
The fix for this issue is in 1.3.1 that is now available. |
1.3.1 = 1.3.230502000 (built May 2, 2023) |
Crash is gone and content no longer needed, so this seems fixed to me 👍 |
JasonWei512
added a commit
to JasonWei512/EnergyStarX
that referenced
this issue
May 10, 2023
No longer needed for Windows App SDK 1.3.230502000: microsoft/microsoft-ui-xaml#8416 (comment)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems like for the new XAML Backdrop APIs to work you have to have both a xaml and a xaml.cs file?
Just doing it like this crashes the application with code 3221226107 (0xc000027b):
Originally posted by @Balkoth in microsoft/WindowsAppSDK#3406 (comment)
The text was updated successfully, but these errors were encountered: