I have a datagrid,in which I want to disable new rows being created at the bottom, when the user clicks on any cell on the datagrid. I only want the default behaviour,add blank row at bottom when the enter key is pressed.
Here is my Datagrid :
<custom:CustomDataGrid ItemsSource="{Binding Items}"
AutoGenerateColumns="False"
RowHeight="27"
Grid.Row="1"
SelectionUnit="CellOrRowHeader"
RowHeaderWidth="30"
CanUserAddRows="true">
<custom:CustomDataGrid.Columns>
<custom:CustomDataGridTextColumn Header="Product Name"
Binding="{Binding ProductName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Width="250" />
<custom:CustomDataGridTextColumn Header="Unit Price"
Binding="{Binding UnitPrice,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Width="130" />
<custom:CustomDataGridTextColumn Header="Qty"
Binding="{Binding Quantity,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Width="130" />
<custom:CustomDataGridTextColumn Header="Amount"
Binding="{Binding Amount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Width="130"
IsLastEditableColumn="True" />
</custom:CustomDataGrid.Columns>
</custom:CustomDataGrid>
How do I prevent blank row being added to the datagrid when the user select other cells on the datagrid