Nested Grid : Grid « Windows Presentation Foundation « C# / CSharp Tutorial






<Window x:Class="LayoutPanels.SharedSizeGroup"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="SharedSizeGroup" Height="300" Width="380">
  
    <Grid Grid.IsSharedSizeScope="True" Margin="3">
      <Grid.RowDefinitions>
        <RowDefinition></RowDefinition>
        <RowDefinition Height="Auto"></RowDefinition>
        <RowDefinition></RowDefinition>
      </Grid.RowDefinitions>

      <Grid Grid.Row="0" Margin="3" Background="LightYellow" ShowGridLines="True">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" SharedSizeGroup="TextLabel"></ColumnDefinition>
          <ColumnDefinition Width="Auto"></ColumnDefinition>
          <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
    
          <Grid Grid.Row="2" Margin="3" Background="LightYellow"  ShowGridLines="True">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" SharedSizeGroup="TextLabel"></ColumnDefinition>
              <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
    
            <Label Margin="5">Short</Label>
            <TextBox Grid.Column="1" Margin="5">A text box</TextBox>
          </Grid>
      </Grid>
    </Grid>
</Window>
WPF Nested Grid








24.42.Grid
24.42.1.Simple Grid.xamlSimple Grid.xaml
24.42.2.Use Grid to layout a CalendarUse Grid to layout a Calendar
24.42.3.Grid with Rectangle and GeometryDrawingGrid with Rectangle and GeometryDrawing
24.42.4.Set Grid Row and Column for a ButtonSet Grid Row and Column for a Button
24.42.5.Arrange UI Elements in a GridArrange UI Elements in a Grid
24.42.6.Align Ellipses along with GridAlign Ellipses along with Grid
24.42.7.Show Grid LinesShow Grid Lines
24.42.8.Multiple Items in a Grid CellMultiple Items in a Grid Cell
24.42.9.Grid in ScrollViewerGrid in ScrollViewer
24.42.10.Margin vs Padding and GridMargin vs Padding and Grid
24.42.11.Window with GridWindow with Grid
24.42.12.Arrange the children for GridArrange the children for Grid
24.42.13.Put more than one Object to one Grid CellPut more than one Object to one Grid Cell
24.42.14.Nested GridNested Grid
24.42.15.Shared Size GroupShared Size Group
24.42.16.Use the Grid element to create a standard user interface (UI) dialog box.Use the Grid element to create a standard user interface (UI) dialog box.
24.42.17.Place and size rectangles and ellipses in Grid cellsPlace and size rectangles and ellipses in Grid cells
24.42.18.Use Image as the Grid backgroundUse Image as the Grid background
24.42.19.Grid with SharedSizeGroupGrid with SharedSizeGroup
24.42.20.Layout a Form with StackPanel and GridLayout a Form with StackPanel and Grid
24.42.21.Layout Controls with Grid in codeLayout Controls with Grid in code