wpfui icon indicating copy to clipboard operation
wpfui copied to clipboard

Maximise does not respect the taskbar when using a borderless window with a TitleBar control

Open SMSAgentSoftware opened this issue 2 years ago • 6 comments

Describe the bug

When using a borderless window, ie WindowStyle="None", and using a TitleBar control to provide the maximize/minimize/close buttons, when maximizing the window it fills the entire screen instead of stopping at the taskbar.

To Reproduce

Create a borderless window with a TitleBar:

<ui:UiWindow x:Class="MyApp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:MyApp" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" mc:Ignorable="d" Title="MyApp" Height="700" Width="1100" MinHeight="580" MinWidth="1100" WindowStyle="None" Background="Transparent" AllowsTransparency="True" ResizeMode="CanResizeWithGrip" WindowStartupLocation="CenterScreen"> <Grid> <Grid.RowDefinitions.../> <Grid.ColumnDefinitions..../> <ui:TitleBar Grid.ColumnSpan="2" Grid.Row="0" Title="MyApp" Foreground="#03DAC5" FontSize="18" CanMaximize="True" UseSnapLayout="True"/>

Use the Maximize button in the TitleBar to maximize the window.

Expected behavior

Maximized window should stop at the Taskbar area.

Screenshots

Instead of stopping at the taskbar:

image

The window covers the entire screen including the taskbar:

image

OS version

Windows 10/11

.NET version

4.8

WPF-UI NuGet version

2.0.3

Additional context

No response

SMSAgentSoftware avatar Feb 23 '23 11:02 SMSAgentSoftware

Setting the WindowStyle to WindowStyle="SingleBorderWindow" fixed this for me.

Inzaniity avatar Jan 04 '24 09:01 Inzaniity

Setting the WindowStyle to WindowStyle="SingleBorderWindow" fixed this for me.

I'm using a borderless window where the titlebar contains the maximise/minimize/close buttons, so WindowStyle must be set to "None" and AllowsTransparency to "True" to prevent the native Window borders from displaying.

SMSAgentSoftware avatar Jan 05 '24 14:01 SMSAgentSoftware

I'm on Win11 and with this XAML

    ExtendsContentIntoTitleBar="True"
    WindowCornerPreference="Round"
    ResizeMode="CanResizeWithGrip"
    WindowStyle="SingleBorderWindow" 

it looks like this: image and this maximized image

worth giving it a shot I

Inzaniity avatar Jan 08 '24 05:01 Inzaniity

I'm on Win11 and with this XAML

    ExtendsContentIntoTitleBar="True"
    WindowCornerPreference="Round"
    ResizeMode="CanResizeWithGrip"
    WindowStyle="SingleBorderWindow" 

it looks like this: image and this maximized image

worth giving it a shot I

Thanks but the WindowStyle must be set to "None" to avoid getting a double border. Also, I unable to use "ExtendsContentIntoTitleBar="True"" for some reason, it throws an exception no matter what I try:

image

SMSAgentSoftware avatar Jan 08 '24 18:01 SMSAgentSoftware

I guess this library is just not set up to handle a WindowStyle of none properly.

SMSAgentSoftware avatar Jan 08 '24 18:01 SMSAgentSoftware