Hi,
can someone explain me the size definition of WPF controls ?
I have a grid. Cell 0,1 has size 300x400. If I put a rectangle into the cell, the maximum height of the rectangle is 383 pixels only, but the width of grid cell is 400. Where is problem ??? Am I imbecile ?
<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="800" Height="500" MaxWidth="800" MaxHeight="500">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="500" />
<ColumnDefinition Width="300" MaxWidth="300"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="400" MaxHeight="400"/>
</Grid.RowDefinitions>
<DockPanel Grid.Column="0" Grid.Row="0">
<Menu DockPanel.Dock="Top">
<MenuItem Header="_File" FontSize="24" FontFamily="Arial">
<MenuItem Header="_New" >
<MenuItem.Icon>
<Image Source="c:\1\WPF-01\Button-Previous-icon.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="_Open" />
<MenuItem Header="_Save" />
<Separator />
<MenuItem Header="_Exit" />
</MenuItem>
</Menu>
</DockPanel>
<Button Grid.Column="0" x:Name="btn001" Content="Hello" Width="200" Height="200" Click="btn001_Click" Grid.Row="1" />
<TabControl Name="tabCtrl_001"
Grid.Column="1" Grid.Row="1"
Width="300"
MaxWidth="300"
Height="383"
MaxHeight="400"
VerticalAlignment="Top"
Margin="0,0,0,0"
Padding="0,0">
<TabItem Name="tabItem_001"
Header="TabItem"
Padding="0,0"
Margin="0,0,0,0"
>
<Grid
Name="grid_002"
Background="#FFE5E5E5"
Margin="0,0,0,0"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="400" />
</Grid.RowDefinitions>
<WrapPanel >
<ScrollViewer Loaded="scrlView_001_Loaded"
Name="scrlView_001"
Grid.Column="0" Grid.Row="0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
VerticalScrollBarVisibility="Visible"
HorizontalScrollBarVisibility="Visible"
Padding="0,0"
Width="300"
Height="312"
BorderBrush="Green" BorderThickness="10"
>
<DockPanel Name="stackPanel1"
Width="310"
Height="800"
MaxWidth="310">
<GroupBox HorizontalAlignment="Left"
VerticalAlignment="Top"
Header="Text"
Margin="4,4,0,0"
Padding="0,0"
Height="401"
Width="180"
Background="White" >
</GroupBox>
</DockPanel>
</ScrollViewer>
</WrapPanel>
</Grid>
</TabItem>
<TabItem Header="TabItem">
<Grid Background="#FFE5E5E5"/>
</TabItem>
</TabControl>
<Rectangle HorizontalAlignment="Left" Margin="426,0,0,0"
Stroke="Black" Width="39"
Height="400" VerticalAlignment="Center" Grid.Row="1"/>
</Grid>
</Window>