0
votes

I have a window in WPF and I have a datagrid and under datagrid I would like to have buttons.

I defined a parent grid like that:

 <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="50*" />
            <RowDefinition Height="50*" />         
        </Grid.RowDefinitions>

So on the first row I would like to have a datagrid that would be in all three columns and under grid I would like to have a button in each column.

If I do like that:

<DataGrid Grid.Row="0" Grid.Column="0"
<Button Grid.Row="1" Grid.Column="0" 
<Button Grid.Row="1" Grid.Column="1"  
<Button Grid.Row="1" Grid.Column="2"

last two buttons are obviously on the right side from the datagrid. How to have all three buttons under the datagrid?

Thank you

1

1 Answers

0
votes

Add Grid.ColumnSpan="3":

<DataGrid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"