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
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 } }}
It would also be easier to use the CellChange event, rather than MouseUp. But you still need to use the Text property of the cell and not the Value.