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
205
Problem setting Active Record
posted

Hello,

 

I'm having a problem setting the IsActive property on the next DataRecord after a previous record has been deleted. I have a collection of 3 grid row objects that are all viewable in a grid. The grid must display a minimum of 3 rows by default. If I delete one of the grid row objects in my collection, I create a new grid row object and add it to my collection. I then call the OnPropertyChanged method in our controller class to rebind the collection to the grid (we are using property descriptors in our collection grid row objects so data doesn't actually reside in the grid row object itself; and therefore, must be retrieved from our data source).

 

For Example:

 

I have 3 rows initially displayed and I delete row 2. My code will remove the second grid row object in the collection and then create a new grid row object and add to the end of the collection to maintain the minimum rows required. I then attempt to set focus back to the second row (since I previously deleted row 2).

 

The problem is that after calling the OnPropertyChanged method, the Record.IsActive for the second row is always false after attempting to set it to true. If I don't rebind the datasource, then I am able to set the IsActive to true. Also, after calling the OnPropertyChanged - the record Index property is set to -1 for the second row. Also even though the all the rows are visible I am unable to get back a CellValuePresenter for any DataRecord. I don't see this problem if I add a 4th row and then delete row 2, everything works fine here.

I guess my question is - under what condition is the record's index set to -1 and what condition can the Record IsActive property not be modified?

Thanks,

 

David