Grid does not get auto size wpf
Posted
by
Jasim Khan Afridi
on Stack Overflow
See other posts from Stack Overflow
or by Jasim Khan Afridi
Published on 2012-10-19T22:52:38Z
Indexed on
2012/10/19
23:01 UTC
Read the original article
Hit count: 234
I have a Grid inside a grid. I want it to to avail maximum size irrespective of window size.
Main_Grid should be max width Grid_tool_bar should be max width
but infact it is not. I am unable to find the reason. Plz help me out.
<Window x:Class="SocialNetworkingApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Background="White" WindowStyle="None" HorizontalAlignment="Stretch" WindowState="Normal" AllowsTransparency="True" WindowStartupLocation="CenterScreen">
<Border Margin="0,0,0,0" BorderBrush="Black" BorderThickness="1,1,1,1" >
<Grid x:Name="Main_Grid" Background="White" Width="Auto" Height="Auto" Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="25"/>
<RowDefinition Height="50"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid Name="Title_Bar" Grid.Row="0" VerticalAlignment="Top" ShowGridLines="True" Grid.IsSharedSizeScope="True" MouseDown="Drag_Window" Background="#FF4FA2DA" HorizontalAlignment="Left" Width="766" Height="31">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="120" />
</Grid.ColumnDefinitions>
</Grid>
</Grid>
</Border>
</Window>
© Stack Overflow or respective owner