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
470
Adding a new item at a specific row
posted

Hi,

I have an ICollectionView ViewSource bound to my XamDataGrid.

How can I add a new item to the ViewSource and display it below the ActiveItem from my ViewModel.

Grouping/Filtering should be ignored for the new item, therefore, newRecord.RefreshSortPosition(); is no option.

Best

Oliver

Parents
No Data
Reply
  • 16495
    Offline posted

    Hello Jan-Oliver,

     

    Thank you for your post.

     

    I have been looking into your requirement and that I can suggest in order to be able to achieve the functionality that you are looking for is to use command with Command Parameter. You can get the SourceCollection and the current active record index and by using the Insert method of ObservableCollection you can add the new item at the position that you wish.

     

     I created short sample application based on your scenario to show you how you can implement this approach and achieved your requirements. Please let me know if I am missing something about your scenario. Take look at the sample application  and if it doesn’t cover your expectations feel free to modify it with the functionality that you are using, so I can investigate it further for you.

     

    If you require any further assistance, please do not hesitate to ask.

    AddingNewItemToSpecificRowFromVM.zip
Children