Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
XamGrid adding row to sorted grid
posted

Hi,

I am trying to add a new row to xamgrid, when the grid is not sorted the row should be added to the top of the grid, but when sorted, the row takes its place between the other rows.

I have some work to do with the row before saving it, so i use the handler (RowAdded) to do it.

Problem : in row added, the row that i will be editing, has the index 0, so if the grid is sorted, and the newly added row doesn't take the index 0, i will be editing another row in (RowAdded)

how to edit the newly added row in the grid regardless to its index in the grid ???

  • 21382
    posted

    Since once the item is comminted from the AddNewRow and placed in the ItemSource it is subject to the current sort of the grid you could either keep the grid sorted on a property that marks your object as new. I don't recall off hand if RowAdded has a property off the event args which points to the row that was added, but I am pretty sure RowAdding does, so you can cache off the value in a local variable until Added and then you have access to the data object.