Skip to content

Commit

Permalink
XamlRoot can be null while content isn't.
Browse files Browse the repository at this point in the history
  • Loading branch information
dotMorten authored Apr 15, 2022
1 parent 94e1f02 commit 3918150
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/WinUIEx/WindowExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static partial class WindowExtensions
/// <remarks>
/// <para><see href = "https://docs.microsoft.com/windows/win32/api//winuser/nf-winuser-getdpiforwindow">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
public static uint GetDpiForWindow(this Microsoft.UI.Xaml.Window window) => (uint?)(window.Content?.XamlRoot.RasterizationScale * 96f) ?? HwndExtensions.GetDpiForWindow(window.GetWindowHandle());
public static uint GetDpiForWindow(this Microsoft.UI.Xaml.Window window) => (uint?)(window.Content?.XamlRoot?.RasterizationScale * 96f) ?? HwndExtensions.GetDpiForWindow(window.GetWindowHandle());

/// <summary>Brings the thread that created the specified window into the foreground and activates the window.</summary>
/// <param name="window">
Expand Down

0 comments on commit 3918150

Please sign in to comment.