tags:

views:

14

answers:

2

I have xaml:

<my:DataGrid x:Name="p_tempDataGrid"  Grid.Row="2" Grid.ColumnSpan="7" >
    <my:DataGrid.Columns>
        <my:DataGridTextColumn Header="Имя" Width="*"/>
        <my:DataGridTextColumn Header="Дата" />
        <my:DataGridTextColumn Header="Коментарии" />
        <my:DataGridTextColumn Header="Цена" />
        <my:DataGridTextColumn Header="Количество"  />
    </my:DataGrid.Columns>
</my:DataGrid>

and I need to add a new row code

tempDataGrid.Items.add(object); what kind of has this object?

A: 

I haven't tried this approach (I would suggest binding your DataGrid.Items to a collection of objects representing the rows), but I would imagine that new DataGridRow() would do the trick

Steve Greatrex
I understand that, but really want without being bind. I do not understand it used new DataGridRow ()
simply denis
A: 

I assume you have assigned DataGrid.ItemsSource property to an object.
If that object is a datatable then you add a row to the datatable and it would show on the grid.
If that object implemented the ObservableCollection interface then you just add an Item to that collection and the new Item gets added to the DataGrid

Vivek
first option may be more, the second I know but so far I do not want to use
simply denis