Hi,
I have a xamdatagrid in my application. The grid has checkboxes in the record selectors. My requirement is that, when I select a record, few of the cells in that record has to be made readonly. When i uncheck it, the cells should be back to their original state. Can you provide some inputs on how this can be achieved?
Thanks, Poornima
Hi Petar,
Thanks for the sample code. I tried the same on my application and it works perfect!
Regards,
Poornima
Hello Poornima,
I have been looking into your requirement and I can suggest creating a style for your XamEdtor for the specific Fields in which you want to disable cells. In those styles you can create a DataTrigger bound to a property that is set by the RecordSelector’s CheckBox and which sets the IsReadonly property of the designated XamEditor. I suggest using the Tag property of the underlying Records since they are not dependent on virtualization and their properties are preserved. And all that would be left to do is bind the RecordSelector’s IsChecked property to the Tag.
I have created a sample project (Grid_selector_checkbox.zip) showing all this in action. I have used a style for the XamTextEditor applied only to the “salary” Field from our sample data. I have also created an IValueConverter of my own, since by default the Tag properties are null, which through the binding causes the CeckBoxes to go in their undetermined state. I have also applied another Setter in the XamTextEditor’s DataTrigger the controls the background in order to better visualize the changes on changing the checked state of the RecordSelector.
Please let me know if you require any further assistance on the matter.