Skip to content

[HELP] Set Minimum width for the Shell #13066

Answered by twojnarowski
TWEESTY asked this question in Q&A
Discussion options

You must be logged in to vote

I am also looking for an answer for this problem. I looked at #2370 and if you reach the point when you have a variable with AppWindow, then you can hook up to the AppWindow.SizeChanged += NativeWindow_SizeChanged; event and in there protect from being too small:

private static void NativeWindow_SizeChanged(object sender, Microsoft.UI.Xaml.WindowSizeChangedEventArgs args)
{
    if (args.Size.Width * 1.05 < 896)
    {
        int height = (int)(args.Size.Height * DeviceDisplay.MainDisplayInfo.Density);

        AppWindow.Resize(new(896, height));
    }

    if (args.Size.Height * 1.05 < 720)
    {
        int width = (int)(args.Size.Width * DeviceDisplay.MainDisplayInfo.Density);

        A…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by TWEESTY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants