Put the datagrid to more columns in WPF

Total Post:70


 1407  View(s)
Rate this:
Hi developers!

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:

            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <RowDefinition Height="50*" />
            <RowDefinition Height="50*" />        

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?

thanks in advance

  1. Re: Put the datagrid to more columns in WPF


    try this

    Add Grid.ColumnSpan="3":

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


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.