Is there any event which Fires when observes that a node from TreeList had the check mark checked from code?

StackOverflow https://stackoverflow.com/questions/8122447

  •  28-02-2021
  •  | 
  •  

Pergunta

I have a part of code which analyzes a list with checked nodes ID's, and checks into the a TreeList existing ID's. (I'm using a XtraTreeList control)

I want to calculate amount for each checked node, and I just though to make this when the node is checked.

Is there any event which observes that a node from TreeList was checked from code (programmatic)?

Cause if I check/uncheck a node with the mouse, or with the keyboard BeforeCheckNode and AfterCheckNode events takes Fire, but when i check the node from code - they don't fires.

foreach (TreeListNode item in tln) {
    var nodeID = (this.tlServices.GetDataRecordByNode(item) as __ServiceInfo).ID;
    if (svc.Select(value => value.Model.service.id).Contains(nodeID)) {
        item.Checked = true;
    }
    else if (item.HasChildren) {
        this.FindNode(item.Nodes, svc);
    }
}
Foi útil?

Solução

You can use the TreeList.NodeChanged event:

void treeList1_NodeChanged(object sender, NodeChangedEventArgs e) {
    if(e.ChangeType == NodeChangeTypeEnum.CheckedState) { 
        // do something
    }
}

Outras dicas

AfterCheckNode is the event.

private void _tree_AfterCheckNode(object sender, DevExpress.XtraTreeList.NodeEventArgs e)
    { TreeListNode node = e.Node as TreeListNode;}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top