XtraTreeList - How can I reset the value of Unbound Boolean Cell to Indeterminate?
I have开发者_StackOverflow中文版 an XtraTreeList with an UnboundColumn of type Boolean, i.e.:
column.UnboundType = DevExpress.XtraTreeList.Data.UnboundColumnType.Boolean;
Initially, all CheckEdits are displayed 'grayed', in the Indeterminate State, and their value is Null.
Is there any way I can reset the values of particular check boxes to this Indeterminate state?
I have tried:
treeListNode[columnID] = null;
but an Error Message Box pops up, with the message: "Null object cannot be converted to a value type."
Also:
treeListNode[columnID] = DefaultBoolean.Default;
and:
treeListNode[columnID] = CheckState.Indeterminate;
but both set the cell's value to True.
Any help would be much appreciated.
Not sure if this still helps you but the other approach that you can try is setting the unbound column type to object and later restoring it.
foreach (var column in treeListNode.Columns)
{
var tc= column as TreeListColumn;
if (tc!= null && tc.Name == columnID)
{
var originalType = tc.UnboundType;
tc.UnboundType = UnboundColumnType.Object;
treeListNode[columnID] = null;
tc.UnboundType = originalType;
break;
}
}
try:
treeListNode[columnID] = DBNull.Value
but I am not sure it works, eventually we have to set the state of the CheckEdit manually.
精彩评论