Click here to Skip to main content
15,346,659 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
when i add new row to data grid programmatically also add a new place holder in bottom of my WPF data grid.
I set CanUserAddRows=True in xaml code.
How i can hide or remove new place holder row of WPF data grid?
Thanks.
Sorry for bad English.
Posted
Updated 11-May-22 0:17am

1 solution

Hi,

it depends how you set the Items collection of the DataGrid.

If the underlying items source implements IEditableCollectionView
you could try this (in code) after setting CanUserAddRows to true:

C#
var editableCollection = (IEditableCollectionView)dataGrid.Items;

if (editableCollection != null)
{
  editableCollection.NewItemPlaceholderPosition = NewItemPlaceholderPosition.None;
}


This should prevent the datagrid to display the new item row.

Regards,

Thomas.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900