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
115
Programatically detect the value of a cell whose ColumnStyle is TriStateCheckBox
posted

I am looking to programatically detect the value of a ultra grid cell whose column style is TriStateCheckBox.

I trap the mouseup event and I have a referenct to the cell, mouseupCell.

I am able to see in the debugger (when running in Debug mode), that teh cell has an AccessibilityObject property, and the AccessiblityObject has a Value property that is a string containing values of "True", "", or "False", but when out of debug mode, the value is ALWAYS String.Empty

I want to know how to detect the check status in the event I am using.

 Gary

Parents
  • 37774
    Verified Answer
    posted

    Gary,

    Do you need the actual accessible object?  Also keep in mind that if you're looking at the *value* of the cell in the MouseUp event, the value likely hasn't changed at this point, so you'd be better off checking the Text property of the cell, which will return the string representation of the checked status, such as:

     private void ultraGrid1_MouseUp(object sender, MouseEventArgs e)
    {
        UIElement element = this.ultraGrid1.DisplayLayout.UIElement.ElementFromPoint(e.Location);
        if (element != null)
        {
            CellUIElement cellElement = element.GetAncestor(typeof(CellUIElement)) as CellUIElement;
            if (cellElement != null)
            {
                string checkStatus = cellElement.Cell.Text;          

                // Do stuff with the checked state                  
            }
        }
    }

Reply Children
No Data