开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜