I have a grid where I'd like to keep using Autogenerated=true when binding to my datasource.
I've set the Fieldsettings to AllowEdit=false to prevent inline fields being edited, but I would like to enable some checkboxes given its data.record meets a particular condition.
For example: Enable checkboxes only when Id > 100 (dashes are disabled checkboxes, brackets are enabled checkboxes)
chkbox Id Date otherstuff...
- 20 1/10/2015 test
- 99 1/5/2015 stuff
[v] 101 1/4/2015 notes
Is this possible? And can I bind a command to the checkbox event to capture this change while conforming to MVVM pattern?
Thank you for your response. I am running 14.1 which does not have the property "AllowEdit=True" in the line
<igDP:Field Name="IsItemChecked" AllowEdit="True" >
Is this still possible with 14.1?
Hello Patrick,Thank you for the provided explanation.I have been looking into your issue in regards to adding checkboxes which are enabled only if a particular cell of the current DataRecord meets certain condition. You should be able to achieve this along with the MVVM pattern by creating an EditorStyle for the Checkbox field and add a couple of Setters for the IsChecked and the IsEnabled properties of the editor respectively.1) The IsChecked property will be bound to a custom property of our DataItem (for example IsItemChecked).
<Setter Property="IsChecked" Value="{Binding DataItem.IsItemChecked, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />2) The IsEnabled property will be bound to a custom property of our DataItem (for example IsItemEnabled).
<Setter Property="IsEnabled" Value="{Binding DataItem.IsItemEnabled, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />The bindings are two-way which means that your DataItem's properties will be set accordingly.3) The Enabled/Disabled logic for the XamCheckEditors can be implemented inside the setter of the field whose value we consider the condition (for example Price). This way every time the Price has been set, we set the IsItemEnabled to either true or false, depending on condition for the price.public double vmPrice{ get { return this.Price; } set { if (value < 1000) this.IsItemEnabled = false; else this.IsItemEnabled = true;
if (value < 0.0) this.Price = 0.0; else this.Price = value; NotifyPropertyChanged("vmPrice"); }}Since we have bound the IsItemEnabled property to the IsEnabled property of the XamCheckEditor for the current record, the XamCheckEditor will be checked/unchecked accordingly as well. I have prepared a sample application where this behavior has been implemented.Would you please take a look at the sample and if you are still experiencing any issues or this is not the behavior you were aiming for, please let me know.