Hello,
I have a XamDataGrid that binds to an object that have only a private constructor. So I had to create my own add new record button. Since I over wrote the add button already implemented in grid, I'm not getting focus on the new record.
1) How can I put the focus on the new added record. Please note that I'm using MVVM pattern.
2) I have set AddNewRecordLocation="OnTop" but the record is getting added on the button.
I'm wondering if someone looking into my question.
Thank you
Can you send a small sample project demonstrating the issue you are having? It's unclear exactly what the issue is. If all you want is to set to activate the first record in the grid you can set the IsActive property on the record.
this.xamDataGrid1.Records[0].IsActive = true;
Hi Michael,
Attached is a sample project that resemble what I'm trying to do. The constructors have to stay private and called through a public factory method.
1) If you click on the add button the focus is not getting set on the newly created record.
2) AddNewRecordLocation="OnTop" but the new record is added to the bottom.
Did you have a chance to a look at the attached project ?
Yes I have. The fact that there is no add new row at the top of your data grid concerns me. I attempted to reproduce this with my own sample and I was not able to. Please see my attached sample below to test how the add new record appears at the top.
Keep in mind that adding records via your command will not make them appear at top of your grid automatically by setting the AddNewRecordLocation property. In order to programmatically add new records at the top you must set the index to zero for each new record added and update the rest of your record's index. The grid loads the records as they appear in your data. So if you are not adding the new records as the first item in your collection they will not appear at the top.
Let me know if you have any questions.