Home > DeveloperSection > Forums > Put the datagrid to more columns in WPF
lois waisbrooker
lois waisbrooker

Total Post:70

Posted on    July-18-2013 11:42 PM


 1 Reply(s)
 960  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

shreesh chandra shukla
shreesh chandra shukla

Total Post:105

Posted on    July-19-2013 12:18 AM

try this

Add Grid.ColumnSpan="3":

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

Don't want to miss updates? Please click the below button!

Follow MindStick