|
@@ -294,6 +294,14 @@ public class DynamicGridTreeUIComponent<T, TKey> : IDynamicGridUIComponent<T>, I
|
|
|
});
|
|
|
|
|
|
_tree.SizeChanged += _tree_SizeChanged;
|
|
|
+ _tree.NodeCollapsed += (sender, args) =>
|
|
|
+ {
|
|
|
+ ResizeColumns(_tree, _tree.Width - 2, _tree.Height - 2);
|
|
|
+ };
|
|
|
+ _tree.NodeExpanded += (sender, args) =>
|
|
|
+ {
|
|
|
+ ResizeColumns(_tree, _tree.Width - 2, _tree.Height - 2);
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
private System.Windows.Controls.ScrollChangedEventHandler? _summaryScrollChangedHandler;
|
|
@@ -1441,6 +1449,40 @@ public class DynamicGridTreeUIComponent<T, TKey> : IDynamicGridUIComponent<T>, I
|
|
|
ResizeColumns(_tree, _tree.ActualWidth - 2, _tree.ActualHeight - 2);
|
|
|
}
|
|
|
|
|
|
+ // public void GetExpandedTreeDepth(TreeNode node, ref int depth)
|
|
|
+ // {
|
|
|
+ // if (node == null || node.ChildNodes == null || node.ChildNodes.Count == 0)
|
|
|
+ // return;
|
|
|
+ //
|
|
|
+ // depth++;
|
|
|
+ // if (!node.IsExpanded)
|
|
|
+ // return;
|
|
|
+ //
|
|
|
+ // int maxChildDepth = 0;
|
|
|
+ // foreach (var child in node.ChildNodes)
|
|
|
+ // {
|
|
|
+ // int childdepth = 0;
|
|
|
+ // GetExpandedTreeDepth(child, ref childdepth);
|
|
|
+ // maxChildDepth = Math.Max(maxChildDepth, childdepth);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // depth += maxChildDepth;
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // private double ExpanderWidth(double columnwidth)
|
|
|
+ // {
|
|
|
+ // var depth = 0;
|
|
|
+ // var children = _tree.View.Nodes.Where(x => x.ParentNode == null && x.HasChildNodes);
|
|
|
+ // foreach (var child in children)
|
|
|
+ // {
|
|
|
+ // var childdepth = 0;
|
|
|
+ // GetExpandedTreeDepth(child, ref childdepth);
|
|
|
+ // depth = Math.Max(depth, childdepth);
|
|
|
+ // }
|
|
|
+ // return depth * columnwidth;
|
|
|
+ // }
|
|
|
+
|
|
|
private void ResizeColumns(SfTreeGrid grid, double width, double height)
|
|
|
{
|
|
|
if (Parent.Data == null || width <= 0)
|
|
@@ -1448,12 +1490,16 @@ public class DynamicGridTreeUIComponent<T, TKey> : IDynamicGridUIComponent<T>, I
|
|
|
|
|
|
grid.Dispatcher.BeginInvoke(() =>
|
|
|
{
|
|
|
- foreach (var (index, size) in this.CalculateColumnSizes(width))
|
|
|
+ var expander = 0; //ExpanderWidth(18.0);
|
|
|
+ var sizes = this.CalculateColumnSizes(width, false);
|
|
|
+ foreach (var (index, size) in sizes)
|
|
|
{
|
|
|
var colSize = Math.Max(0.0F, size);
|
|
|
- _tree.Columns[index].Width = colSize;
|
|
|
+ _tree.Columns[index].Width = colSize.IsEffectivelyEqual(0.0) ? double.NaN : colSize;
|
|
|
+ _tree.Columns[index].ColumnSizer = colSize.IsEffectivelyEqual(0.0) ? TreeColumnSizer.Star : TreeColumnSizer.None;
|
|
|
}
|
|
|
-
|
|
|
+ _tree.TreeGridColumnSizer.Refresh();
|
|
|
+
|
|
|
RebuildSummaryRow();
|
|
|
});
|
|
|
}
|