How to enable NewItem Placeholder in WPF data grid

I have a wpf datagrid associated with an observable collection. I don't currently have a NewItemPlaceHolder. How to enable NewItemPlaceholder (empty line at the bottom for adding new lines)? This is how I declared my datagrid:

    <WpfToolkit:DataGrid x:Name="grid"
        ItemsSource="{Binding Path=SampleObservableCollection}" 
        HorizontalScrollBarVisibility="Hidden" SelectionMode="Single"
        CanUserAddRows="True" CanUserDeleteRows="True"
        CanUserResizeRows="False" CanUserSortColumns="False"
        CellEditEnding="grid_CellEditEnding"
        CurrentCellChanged="grid_CurrentCellChanged" 
        AutoGenerateColumns="False"
        RowHeaderWidth="17" RowHeight="25">
        <WpfToolkit:DataGrid.Columns> ...

thank

+3
source share
1 answer

Verify that the type of objects in the collection has a default constructor. If this is not so, then the DataGrid will not be able to create a new one for the new row.

Also see. Fooobar.com/questions/222036 / ... .

+2
source

Source: https://habr.com/ru/post/1752912/


All Articles