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
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Thanks for the reply.
As I was on vacation couldn't follow this up.
I'm having a problem in the header background color. I changed the content template as below,
<Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <Grid > <CheckBox Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" Background="Transparent"/> <TextBlock Text="IsDeleted" Background="Black" ></TextBlock> </Grid> </DataTemplate> </Setter.Value> </Setter>
And I am using Theme="IGTheme". The problem is I'm not getting the column header color as other columns. Can you please let me know how to keep the column header color in align with the theme?
You can set the Background of the TextBlock to Transparent. This way the header will look like you want.