PUT THE DATAGRID TO MORE COLUMNS IN WPF

lois waisbrooker

Total Post:70

Points:494
Posted by  lois waisbrooker
WPF 
WPF
 1011  View(s)
Ratings:
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:

 <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?


thanks in advance

  1. shreesh chandra shukla

    Post:105

    Points:735
    Re: Put the datagrid to more columns in WPF

    HI!

    try this

    Add Grid.ColumnSpan="3":

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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!