Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
Checkbox Enabled depending on value of another column
posted

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

Parents
  • 2125
    Verified Answer
    posted

    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

    CheckBoxDisabling.zip
  • 225
    posted in reply to [Infragistics] Yanko Manolov

    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??

Reply Children