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
1540
How to know if a TreeStateCheckBox on a UltraGridCell is checked ?
posted

Hello!

I have a WinGrid on my APP that has a Cell with TreeStateCheckbox Style.

Now I need to interpret the checkbox state. How can I do this?

If I had a checkbox with two states only I'll do : (Convert.ToBoolean(e.Cell.Value) == true) to checked and (Convert.ToBoolean(e.Cell.Value) == false) to unchecked. But how can I interpret the third state?

Thank you.

Best regards,

Maria

Parents
  • 71886
    Offline posted

    Hello Maria,

    I am using the following code in order to determine the state:

    if (e.Cell.Value.ToString() != "")
                {
                    if ((Convert.ToBoolean(e.Cell.Value)).ToString() == bool.TrueString)
                    {
                        Console.WriteLine("It is true now!");
                    }
                    else if ((Convert.ToBoolean(e.Cell.Value)).ToString() == bool.FalseString)
                    {
                        Console.WriteLine("It is false now!");
                    }
                }
                else Console.WriteLine("It is in the intermediate state now!");
    

     

    Please try it out and let me know if it suits your needs.

Reply Children
No Data