I'm trying to create a quadratic window with a size of 300x300. But the window's size doesn't seem to reflect what I wrote into my XAML. For example, I created a completely new window and set
Height="300" Width="300"
I didn't change or add anything else. The window shows correctly as 300x300 in the Designer. But when I run the program I get a window that's 284x291. Why? If I set it to 309x316 the window becomes 300x300.
This is really a big problem, since controls are actually going out of bounds now. I designed this window:
<Window ...
Title="MainWindow" Height="150" Width="300">
<Grid>
<StackPanel Margin="10">
<TextBox Margin="0,0,0,10" Text="Textbox"/>
<TextBox Margin="0,0,0,10" Text="Textbox"/>
<TextBox Margin="0,0,0,10" Text="Textbox"/>
<Button Content="Test"/>
</StackPanel>
</Grid>
But the actual window looks like this:
Am I supposed to add random pixel values to the height until it fits in the window? I don't really understand why the size is different and how I'm supposed to deal with it.