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
220
Suppress empty Bands
posted

I have to show a treeView with objects, where each of them has two list attributes. Sometimes one of the lists is empty. Can I suppress the BaseNode (in the shown example the RequirementsList) of an empty list?

The objects to be listed are based on the entityframework. For each list is a getter defined, who loads the list by ObjectQuery and returns the result as List.

Thanks: Rudi

Parents
  • 469350
    Offline posted

    Hi Rudi,

    You could do something like this:


            private void ultraTree1_InitializeDataNode(object sender, Infragistics.Win.UltraWinTree.InitializeDataNodeEventArgs e)
            {
                if (e.Node.IsBandNode &&
                    e.Node.Nodes.Count == 0)
                {
                    e.Node.Visible = false;
                }
            }

    This has a small performance implication since the tree now has to check for child nodes under every band node immediately when they are created. If you were binding to a DataSet, that could be an expensive operation. I don't know if the same is true of the EntiryFramework objects or not.

Reply Children
No Data