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
Reading Value from UnBound Check Box

I have the following code in my XAML file:


                    <!-- define a style for a check box -->
                        <Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="CheckBoxCell">
                            <Setter Property="Template">
                                        <CheckBox HorizontalAlignment="Center" VerticalAlignment="Center"/>


                    <igDP:UnboundField Label="CheckBox field">
                                CellValuePresenterStyle="{StaticResource CheckBoxCell}"/>


The check box displays perfectly in the grid.  However when I check or un-check the box the value is always null.  How can I read, from C# code, whether the check box is checked or not?


Also is there are way to display the check box on some rows and not others?  Is there a way to do this in C# code?


No Data
  • 138253
    Offline posted



    It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking through your post and I suggest you use the following code:


    CheckBox cb = Utilities.GetDescendantFromType(CellValuePresenter.FromCell(xamDataGrid1.ActiveCell), typeof(CheckBox), false) as CheckBox;
    bool? isChecked = cb.IsChecked;


    In order to get the state of the CheckBox in the XamDataGrid’s ActiveCell. As for your other question, you can look in the Feature Browser under xamDataGrid \ Themes and Custom Styles \ Conditional Formatting section and with little modifications you can bind the Visibility of the CheckBox to another value of you Record and, by using a converter, you can return different Visibilities, depending on that Value.


    Feel free to write me if you have further questions.

No Data