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
190
Conditional checkbox enabled in xamgrid
posted

I would like to have a checkbox in the xamgrid be enabled conditionally on data that is in the same row as the data behind the grid, so for example

data behind is

tool name / is checked out / by whom

hammer false numm

saw false null

rake true me

screw driver true notme

so the grid would have three columns and the only time the check box is enabled is when it is not checked or when it is checked and by whom equals me.

When I attempted using a template and used the on load event to set the checkbox, when I scrolled down I saw other rows that eneded up being checked.  Do you have advice?

Parents
No Data
Reply
  • 6912
    Suggested Answer
    posted

    hi,

    You can try to use TemplateColumn. The ItemTemplate will be a checkbox and you can control the Visibility of the checkbox using a custom IValueConverter. It will look something like that:

    ...
    <DataTemplate>
       <CheckBox IsChecked="{Binding IsCheckedOut}" Visibility="{Binding IsCheckedOut, Converter={StaticResource MyCustomBoolToVisibilityConverter}}" />
    ...

    HTH

Children
No Data