Click here to Skip to main content
15,905,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a datagrid which is bound to a list in TwoWay path.
the default behavior of the enter key for the grid which i found is move down.

i used the following code to make the movement to the right

C#
var element = e.OriginalSource as FrameworkElement;
if (e.Key == Key.Enter)
            {
                e.Handled = true;
                element.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
            }


But now the issue to my grid is that it does not add an empty row to for the new item. It is not making any new item place holder.

1) Is there a way to add manually a new empty row in DataGrid in wpf or
2) can i use any method to make my grid to be able to add a new row or move to the next new row after the last focusable column?
thank you in advance.
Posted
Comments
WaseemAmin 8-May-14 3:25am    
Basically i was assuming to add manually the NewItemPlaceholder by myself but I can't. So your mentioned way is its default way to add it, and i have to do it in this way and have to accept it with no other choice.

1 solution

As you said, you have bound the Datagrid with List. Then adding one item to List will automatically add new row in Datagrid. Try this way.
 
Share this answer
 
v2

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