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
1160
How to diable selection property of Parent Node in XAMDataTree.
posted

Hi,

We are using XAM data Tree and adding parent and their child Node. We have added Is Selected property for child node. But we want that we can select only child Node, not its parent Node. We want to disable the selection property of parent node.

Please let us aware for that.

Thanks

Parents
  • 17475
    Offline posted

    Hello Kanwar,

    The selected nodes settings are applied for all layouts of the tree so I would suggest you to handle the SelectedNodesCollectionChanged event and remove the last selected node if it is part of the parent layout. Here is a code snippet for the same:
    private void MyTree_SelectedNodesCollectionChanged(object sender, NodeSelectionEventArgs e)
            {
                if ( (e.CurrentSelectedNodes.Count>0) && (e.CurrentSelectedNodes[e.CurrentSelectedNodes.Count-1].NodeLayout.Key == "CategoryLayout"))
                    e.CurrentSelectedNodes.RemoveAt(e.CurrentSelectedNodes.Count - 1);
            }
    If you have any other questions, feel free to update the thread.

Reply Children
No Data