How to cancel adding a new row?

Oct 13, 2009 at 9:12 AM

Hi,

The DataGrid control is a very great control. When I use it , I encounter a problem while adding a new row.

Normally, to add a new row, we have to double click the New Row, type some data and move the focus to other controls. As a result,  a new row is added to the grid. But how to handle the following situation? When adding a person, there are two text boxes for peron's names, ideally, if the user doesn't type any names, a new row won't be added.  I have tried several times, but the data grid always added a new row with empty names.

How can I cancel adding? Any help is appreciated. Thanks.

Oct 14, 2009 at 12:15 PM

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

<

</font></font><font size="2" color="#0000ff">

 

</font>

wpf:DataGrid

<font size="2" color="#ff0000"><font size="2" color="#ff0000">

CanUserAddRows

</font></font><font size="2" color="#ff0000">

 

</font>

="False"

.

.

.

Oct 14, 2009 at 12:17 PM

<wpf:DataGrid Name="......"
     CanUserAddRows="False"
     .
     .
     .