Hi, this is a simple question but I am having trouble doing this:
I have a xamdatagrid which is bound to a datasource in the codebehind.
the grid has three columns. one is a boolean, one is a string and one is an integer.
if the integer column contains a number greater than 5 then I want the boolean column (which is displayed as a checkbox) to be disabled. If the integer column is less than 5 than the boolean column should be enabled (i.e. I can check or uncheck it).
thanks
Hi JasdeepGill,
You could use the following style for the CellValuePresenter:
<Style TargetType="{x:Type igDP:CellValuePresenter}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=Field.Name, RelativeSource={RelativeSource Self}}" Value="Status"> <Setter Property="IsEnabled" Value="{Binding RelativeSource={RelativeSource Self}, Path=Record.Cells[Number].Value, Converter={StaticResource cellValueConverter}}" /> </DataTrigger> </Style.Triggers></Style>
The attached CheckBoxDisabling sample application contains the full solution implementation.
Best Regards,Yanko
Hi ymanolov ,
code's working fine, but how do the checkbox get rendered in the cells of XamDataGrid??
As i see it, nothing was done to add a checkbox to the cells??
The XamDataGrid does that automatically. The default ValueEditor for boolean value is XamCheckEditor.
You can see the default editors for types here
Please let me know if you have any more questions on this matter.
Thanks Alex!!