0
votes

I'm currently trying to implement page with CRUD operations for Entity.

Let's imagine we have model called User with properties:

Name,

Surname,

Age,

IsMarried,

HomeAdress.

I'm going to show all those fields in DataGrid on UserInfoView. The grid should support inline adding and editing.

I started from this example:

http://blogs.msdn.com/b/brada/archive/2009/10/27/index-for-business-apps-example-for-silverlight-3-rtm-and-net-ria-services-july-update.aspx

and in my UserInfoViewModel I have property UserCollection of type EntityCollectionView bound to DataGrid.ItemsSource.

In case I'm adding new item into UserCollection in my grid corresponding item is showing in the bottom of the grid, is there some way to show it in the top of the grid ?

Also is there some way to immediately enter into edit state for newly added row. (Currently newly added row is selected but it is not in edit state.)

1

1 Answers

0
votes

You can scroll your new row in to view by using dataGrid.ScrollToView method. If you want to show newly added item as first item in grid, insert the item at the first position in your entity collection.

For entering the edit state, you can make use of the dataGrid.BeginEdit method. This method can be called after setting the selected item as newly added item.