Hi,
I tried to create a Grid with two columns and two rows. A left bottom Cell (0,1) has size 400x300px - see the image below. I tried to insert an oblong of size 100x300 into the cell, but the oblong is too large. I do not understand why ? The Height of the cell is 300, the Height of the oblong is also 300, but the oblong overlaps the cell of approx 20 pixels. Why ? Why ? Why ?
I have MS VS 2019 16.9.5, WPF .NET5.
XAML code:
I tried to create a Grid with two columns and two rows. A left bottom Cell (0,1) has size 400x300px - see the image below. I tried to insert an oblong of size 100x300 into the cell, but the oblong is too large. I do not understand why ? The Height of the cell is 300, the Height of the oblong is also 300, but the oblong overlaps the cell of approx 20 pixels. Why ? Why ? Why ?
I have MS VS 2019 16.9.5, WPF .NET5.
XAML code:
C#:
<Window x:Class="WpfApp.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:WpfApp"
mc:Ignorable="d"
Title="MainWindow" Width="600px" Height="400px">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400px"/>
<ColumnDefinition Width="200px"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="100px"/>
<RowDefinition Height="300px"/>
</Grid.RowDefinitions>
<Rectangle Grid.Column="0" Grid.Row="1"
Width="100px"
Height="300px"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="200px,0px,0px,0px"
Stroke="Black" />
</Grid>
</Window>