I created this simple demo because I'm having problems with automatic sizing in WPF. This is simple code:
<Window x:Class="UnderstandSizing.Window3" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" SizeToContent="WidthAndHeight" ResizeMode="NoResize" > <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <TabControl Grid.Row="0" > <TabItem Header="CCCC" /> </TabControl> <Button Grid.Row="1" Content="Text" /> </Grid> </Window>
Since the grid is set to "Auto" and the window is set to sizetocontent, I expected that I would have a TabControl and a button, and there is nothing in the window, but there are empty spaces on it. Take a look:
Development time
lead time
Something is missing me ...
source share