private void TreeView_QueryNodeSize(object sender, Syncfusion.XForms.TreeView.QueryNodeSizeEventArgs e)
        {
            var calculatedNodeSize = e.GetActualNodeHeight();
            var node = e.Node.Content as ITreeItem;

            Debug.WriteLine($"Node {node.Id} header {node.Header} with {node.Items.Count} children is {calculatedNodeSize}dp high");

            if (NodeSize.ContainsKey(node.Id))
            {
                if (NodeContent[node.Id] == node.Header)
                {
                    // should be the same
                    Debug.WriteLine($"Content same, previous size = {NodeSize[node.Id]} new size {calculatedNodeSize}");
                }
                else
                {
                    // the content is different, so the size should be different
                    Debug.WriteLine($"Content different, previous size = {NodeSize[node.Id]} new size {calculatedNodeSize}");

                    if (NodeSize[node.Id] == calculatedNodeSize)
                    {
                        Debug.WriteLine($"Content different, but size hasnt changed");
                    }

                    NodeContent[node.Id] = node.Header;
                    NodeSize[node.Id]    = calculatedNodeSize;
                }
            }
            else
            {
                NodeSize.Add(node.Id, calculatedNodeSize);
                NodeContent.Add(node.Id, node.Header);
            }

            e.Height  = e.GetActualNodeHeight();
            e.Handled = true;
        }
Beispiel #2
0
 private void TreeView_QueryNodeSize(object sender, Syncfusion.XForms.TreeView.QueryNodeSizeEventArgs e)
 {
     e.Height  = e.GetActualNodeHeight();
     e.Handled = true;
 }