C
C#4mo ago
Sk8teee

How to change windows application size in Avalonia UI

Iam trying do downscale my windows application size to the size of my gui but cant find a way.
No description
No description
No description
No description
No description
7 Replies
Sk8teee
Sk8teee4mo ago
sorry for the many pictures i press cntrl + v to often
Keswiik
Keswiik4mo ago
First off, what do you mean by "application size to the size of my gui"? Is the white space around that view the main window to your application?
Sk8teee
Sk8teee4mo ago
yea
Keswiik
Keswiik4mo ago
Then you likely have hardcoded Width and Height properties of some sort in your MainWindow.axaml or in one of the components within
Sk8teee
Sk8teee4mo ago
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:KagateeeLauncher.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:KagateeeLauncher.Views"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="KagateeeLauncher.Views.MainWindow"
Icon="/Assets/avalonia-logo.ico"
Title="KagateeeLauncher">

<views:MainView />
</Window>
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:KagateeeLauncher.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:KagateeeLauncher.Views"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="KagateeeLauncher.Views.MainWindow"
Icon="/Assets/avalonia-logo.ico"
Title="KagateeeLauncher">

<views:MainView />
</Window>
do you mean this ?
Keswiik
Keswiik4mo ago
Yes. I'd make sure none of the components you have (or panels / etc) in your view are not explicitly setting height. Then, add a SizeToContent property to the window and have it scale by WidthAndHeight
Sk8teee
Sk8teee4mo ago
thanks