Hello,
I have a property IsDeleted of bool type in the itemsource of XamDataGrid. I need to add a headername IsDeleted with checkbox. So whenever I click the column header it has to select all the below rows and isdeleted for each row needs to be udpated in my viewmodel(Following MVVM).
Can you please help me in this.
Thanks
Any update on this?
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I created aStyle for the LabelPresenter of the “IsDeleted” Field and added a CheckBox. I also handled the checked and unchecked events and in their handlers I select or unselect all the records. I also bound the DataREcordPresenter’s IsSelected Property to the IsDeleted one from the viewmodel. Please note that you are not able to check a checkBox and select the record, currently this is a limitation and the thing you can do is log a Product Idea for adding IsSelectedPath property to the DataRecordPresenter here:
http://ideas.infragistics.com/
Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
Thanks Stephan. I have two issues here
1. As I'm using MVVM this solution is not feasible.I'm not interested in having checked and unchecked events behind view.
2. Moreover I found that if some items are unselected, the column header is still in selected state. I would expect it to be faded grey color if some items are selected and some items are not selected.
Please let me know if you need more information
Here you can see how to handle events in MVVM way:
http://social.technet.microsoft.com/wiki/contents/articles/18199.event-handling-in-an-mvvm-wpf-application.aspx
As for the three state, I can suggest you see the sample in the Samples Browser under xamDataGrid / Display / Checkbox in Record Selectors section where this functionality is achieved. Please let me know if this helps you or you have further questions on this matter.