Skip to content

[Enhancement] Don't remove window border if MaxWidth/MaxHeight < Resolution on maximize #2729

Closed
@Deadpikle

Description

What steps will reproduce this issue?

  1. Set MaxHeight/MinHeight to < resolution of monitor
  2. "Maximize" application by dragging to top of screen or by clicking the maximize button
  3. Window border is gone!

If MaxWidth/MaxHeight is < the current resolution of the monitor, the application can still be "maximized" by dragging the window to the top of the monitor. This happens in stock WPF apps and is OK. However, I think the window border shouldn't be removed in this case. It isn't removed in stock WPF apps.

Comparison screenshot:
comparison

The top window is a stock WPF app; the lower window is a MetroWindow. Note that both windows were "maximized" by dragging the title bar to the top of the screen.

Code

Stock WPF:

<Window x:Class="DataDrivenMenusSample.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" MaxHeight="300" MaxWidth="300">
    <Grid>
    </Grid>
</Window>

MetroWindow:

<Controls:MetroWindow x:Class="MaximizeWindowTest.MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
                      Title="MainWindow"
                      Height="400"
                      Width="400"
        BorderBrush="{DynamicResource AccentColorBrush}"
        BorderThickness="1"
        TitleCaps="False"
        WindowButtonCommandsOverlayBehavior="HiddenTitleBar"
        UseNoneWindowStyle="False"
        MaxHeight="400" 
        MaxWidth="400"
        WindowStartupLocation="CenterScreen"
        WindowTransitionsEnabled="False"
        Opacity="1"
        ShowDialogsOverTitleBar="False">
    <Grid>
    </Grid>
</Controls:MetroWindow>

Expected outcome

MetroWindow should retain its border when maximized by dragging to the top of the screen or by clicking the maximize button when the MaxHeight/MaxWidth < monitor resolution (can't be fully maximized, in other words).

--

Environment

  • MahApps.Metro 1.4.0-alpha026
  • Windows 10 (Anniversary Update)
  • Visual Studio 2015
  • .NET Framework 4.5

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions