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
1925
xamDataTree node image with datatriggers
posted

How can xamDataTree node's image can be controlled by datatriggers based on a value from viewmodel and treenodes are always expanded?

Parents
  • 2490
    Offline posted

    Hello,

    One way to achieve the functionality you are looking for, to control the XamDataTree node's image, is through the use of converter. You can bind to a property in the ViewModel (e.g. custom property IsActive) and change the Image source depending on this property's value. You can use the converter in the CollapsedIconTemplate and ExpandedIconTemplate.

    For your second question, you can load the XamDataTree with all the Nodes expanded, by recursively iterating through them:

        private void ExpandAllNodes(IEnumerable<XamDataTreeNode> nodes, bool isExpandNode)
            {
                foreach (var node in nodes)
                {
                    node.IsExpanded = isExpandNode;
                    ExpandAllNodes(node.Nodes, isExpandNode);
                }
            }

    To illustrate all this I have prepared a sample application.

    If you need further assistance concerning this matter, please let me know.

    XamDataTree_Images.zip
Reply Children