locked
How to make asymmetric grid RRS feed

  • Question

  • I need to make asymetric grid like following.

    The grid consists of 2 rows

    The row1 consists of 2 columns

    Row1:Column1 will have Labels

    Row1:Column2 will have TextBoxes

    Row2 will have DataGrid

    How to define Grid in the XAML?

    • Moved by CoolDadTx Thursday, July 23, 2020 1:56 PM WPF related
    Thursday, July 23, 2020 6:34 AM

Answers

  • For example =>

         <Grid> 
         
    			<Grid.RowDefinitions>
    			<RowDefinition />
    			<RowDefinition Height = "Auto" />
    			<RowDefinition />
    			</Grid.RowDefinitions>
    
    			<GridSplitter Grid.Row = "1"
    			 HorizontalAlignment = "Stretch"
    			 VerticalAlignment = "Center"
    			 Background = "DarkSlateBlue"
    			 ShowsPreview = "True"
    			 Height = "5" />
    
    			<Grid Grid.Row = "0">
    			<Grid.ColumnDefinitions>
    			<ColumnDefinition />
    			<ColumnDefinition Width = "Auto" />
    			<ColumnDefinition />
    			</Grid.ColumnDefinitions>
    
    			<GridSplitter Grid.Column = "1"
    			 HorizontalAlignment = "Center"
    			 VerticalAlignment = "Stretch"
    			 Background = "DarkSlateBlue"
    			 ShowsPreview = "True"
    			 Width = "5" />
    
    			</Grid>
    			
    	</Grid>

    • Marked as answer by Jeff0803 Friday, July 24, 2020 4:36 AM
    Thursday, July 23, 2020 8:21 AM
  • For the data grid you can also use ColumnSpan, something like this:

    <Grid>

        <Grid.ColumnDefinitions>

            <ColumnDefinition/>

            <ColumnDefinition/>

        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>

            <RowDefinition/>

            <RowDefinition />

        </Grid.RowDefinitions>

        <DataGrid Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" >

        </DataGrid>

    </Grid>

    The first row can be probably divided into two rows, for ID and Password lines.


    • Edited by Viorel_MVP Thursday, July 23, 2020 11:36 AM
    • Marked as answer by Jeff0803 Friday, July 24, 2020 4:36 AM
    Thursday, July 23, 2020 11:35 AM

All replies

  • For example =>

         <Grid> 
         
    			<Grid.RowDefinitions>
    			<RowDefinition />
    			<RowDefinition Height = "Auto" />
    			<RowDefinition />
    			</Grid.RowDefinitions>
    
    			<GridSplitter Grid.Row = "1"
    			 HorizontalAlignment = "Stretch"
    			 VerticalAlignment = "Center"
    			 Background = "DarkSlateBlue"
    			 ShowsPreview = "True"
    			 Height = "5" />
    
    			<Grid Grid.Row = "0">
    			<Grid.ColumnDefinitions>
    			<ColumnDefinition />
    			<ColumnDefinition Width = "Auto" />
    			<ColumnDefinition />
    			</Grid.ColumnDefinitions>
    
    			<GridSplitter Grid.Column = "1"
    			 HorizontalAlignment = "Center"
    			 VerticalAlignment = "Stretch"
    			 Background = "DarkSlateBlue"
    			 ShowsPreview = "True"
    			 Width = "5" />
    
    			</Grid>
    			
    	</Grid>

    • Marked as answer by Jeff0803 Friday, July 24, 2020 4:36 AM
    Thursday, July 23, 2020 8:21 AM
  • For the data grid you can also use ColumnSpan, something like this:

    <Grid>

        <Grid.ColumnDefinitions>

            <ColumnDefinition/>

            <ColumnDefinition/>

        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>

            <RowDefinition/>

            <RowDefinition />

        </Grid.RowDefinitions>

        <DataGrid Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" >

        </DataGrid>

    </Grid>

    The first row can be probably divided into two rows, for ID and Password lines.


    • Edited by Viorel_MVP Thursday, July 23, 2020 11:36 AM
    • Marked as answer by Jeff0803 Friday, July 24, 2020 4:36 AM
    Thursday, July 23, 2020 11:35 AM
  • This forum is for C#-specific questions only. Please post questions related to WPF and XAML in the Microsoft Q&A forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Thursday, July 23, 2020 1:56 PM
  • Sorry I didn't know that WPF is separate category.

    I will post WPF question on that in the future.

    Friday, July 24, 2020 4:37 AM