Open DCorrBECare opened 2 months ago
Also running into this issue, worked fine on 1.5. Is there any fix / workaround?
@Usergitbit There is no fix that I'm aware of and I do not now if this will be fixed in the next release.
I guess as a workaround you can manually implement the MaxWidth/MaxHeight/MinWidth/MinHeight on the window, set the window resizable and set the same value to the max and min property. The downside would be that the cursor appears to be resizable on the window when it's actually not.
You can look at this great project for extended features on the Window class.
Also running into this issue, worked fine on 1.5. Is there any fix / workaround?
You can remove the style for the frame :
private IntPtr hWndMain = IntPtr.Zero;
hWndMain = WinRT.Interop.WindowNative.GetWindowHandle(this);
SetWindowLong(hWndMain, GWL_STYLE, (IntPtr)(GetWindowLong(hWndMain, GWL_STYLE) & ~(WS_DLGFRAME)));
with :
const int GWL_STYLE = (-16);
const int GWL_EXSTYLE = (-20);
public static IntPtr SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong)
{
if (IntPtr.Size == 4)
{
return SetWindowLongPtr32(hWnd, nIndex, dwNewLong);
}
return SetWindowLongPtr64(hWnd, nIndex, dwNewLong);
}
[DllImport("User32.dll", CharSet = CharSet.Auto, EntryPoint = "SetWindowLong")]
public static extern IntPtr SetWindowLongPtr32(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
[DllImport("User32.dll", CharSet = CharSet.Auto, EntryPoint = "SetWindowLongPtr")]
public static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
public static long GetWindowLong(IntPtr hWnd, int nIndex)
{
if (IntPtr.Size == 4)
{
return GetWindowLong32(hWnd, nIndex);
}
return GetWindowLongPtr64(hWnd, nIndex);
}
[DllImport("User32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)]
public static extern long GetWindowLong32(IntPtr hWnd, int nIndex);
[DllImport("User32.dll", EntryPoint = "GetWindowLongPtr", CharSet = CharSet.Auto)]
public static extern long GetWindowLongPtr64(IntPtr hWnd, int nIndex);
public const int WS_DLGFRAME = 0x00400000;
That seems to work for me, thanks @castorix!
Workaround works for me, but still it's a workaround please fix that
Really annoying bug where customers are asking questions to the developer (us) on why their app is "messed up".. Years later and WinUI3 is still terrible
This trick works for me after upgrading 1.6 even though I decided to revert back to 1.5 because of other issues.
ExtendsContentIntoTitleBar = true;
presenter.IsResizable = false;
presenter.SetBorderAndTitleBar(true, false);
This trick works for me after upgrading 1.6 even though I decided to rollback back to 1.5 because of other issues.
ExtendsContentIntoTitleBar = true; presenter.IsResizable = false; presenter.SetBorderAndTitleBar(true, false);
Nice Trick tnx
Try OverlappedPresenter.CreateForContextMenu()
Just did some reverse work: CreateForContextMenu = WS_BORDER CreateForDialog = WS_SYSMENU | WS_CAPTION CreateForToolWindow = WS_OVERLAPPEDWINDOW
IsAlwaysOnTop = WS_EX_TOPMOST IsMaximizable = WS_MAXIMIZEBOX IsMinimizable = WS_MINIMIZEBOX IsModal = Enable/Disable parent Window and some other stuff (restricted to hwnd with owner set) See https://github.com/microsoft/WindowsAppSDK/issues/3258 IsResizable = WS_SIZEBOX(WS_THICKFRAME)
Describe the bug
With the 1.6 version i get a white border around a window that's not resizable.
Steps to reproduce the bug
Create a window with the following code:
Expected behavior
There is no border around the window
Screenshots
NuGet package version
WinUI 3 - Windows App SDK 1.6.0: 1.6.240829007
Windows version
Windows 11 (22H2): Build 22621
Additional context
Works fine with WindowsAppSDK 1.5.240802000