wpfui icon indicating copy to clipboard operation
wpfui copied to clipboard

UiWindow this.Height is not adjusting in code

Open project-sbc opened this issue 2 years ago • 2 comments

Describe the bug

I am setting the height dynamically in code after load using the loaded event this.Height = wpfScreen.WorkingArea.Height; On my current monitor this is 1440. However, the window size will not respect this value and remains whatever it is in xaml.

I have dpiawareness enabled in an app.manifest

Here is my UiWindow xaml: <ui:UiWindow x:Class="Everything_Handhelds_Tool.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:Everything_Handhelds_Tool" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" mc:Ignorable="d" WindowStyle="None" Title="Everything Handhelds Tool" Left="0" Top="0" Width="500" Height="700" ResizeMode="NoResize" AllowsTransparency="True" Loaded="UiWindow_Loaded" Closing="Window_Closing" >

To Reproduce

If I convert the window to a typical WPF Window ONLY changing the xaml and the class base <Window x:Class="Everything_Handhelds_Tool.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:Everything_Handhelds_Tool" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" mc:Ignorable="d" WindowStyle="None" Title="Everything Handhelds Tool" Left="0" Top="0" Width="500" Height="700" ResizeMode="NoResize" AllowsTransparency="True" Loaded="UiWindow_Loaded" Closing="Window_Closing" >

the loaded event's this.Height property works correctly.

Expected behavior

Expect the window height to adjust using this.Height during runtime.

Screenshots

First screenshot is the WPF UI UiWindow with this.Height = 1100; The height is not 1100.

using ui:UiWindow

Second screenshot (changing window type lost the theming, so ignore the white screen) is the base WPF Window with this.Height = 1100; using Window height sets to 1100 as written in c#

OS version

Windows 10 .0.19044 image

.NET version

.net 6

WPF-UI NuGet version

WPF UI 2.0.3

image

Additional context

Other options such as this.MinHeight do work using the UiWindow

project-sbc avatar Aug 17 '23 00:08 project-sbc

I have this issue too

aliajboy avatar Dec 28 '23 21:12 aliajboy