|
@@ -23,6 +23,7 @@ using System.Windows.Media.Imaging;
|
|
|
using Syncfusion.UI.Xaml.TreeGrid.Filtering;
|
|
|
using Syncfusion.UI.Xaml.TreeGrid.Cells;
|
|
|
using System.Windows.Controls.Primitives;
|
|
|
+using NPOI.OpenXmlFormats.Dml;
|
|
|
|
|
|
namespace InABox.DynamicGrid;
|
|
|
|
|
@@ -354,6 +355,8 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
grid.AddChild(summaryScroll, 1, 0);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ RebuildSummaryRow();
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -754,6 +757,10 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
style.Setters.Add(new Setter(Control.HorizontalContentAlignmentProperty,
|
|
|
column != null ? gridColumn.HorizontalAlignment(typeof(double)) : HorizontalAlignment.Right));
|
|
|
}
|
|
|
+ else if(column is DynamicTextColumn textColumn)
|
|
|
+ {
|
|
|
+ style.Setters.Add(new Setter(Control.HorizontalContentAlignmentProperty, textColumn.Alignment.HorizontalAlignment(typeof(string))));
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
style.Setters.Add(new Setter(Control.HorizontalContentAlignmentProperty, HorizontalAlignment.Right));
|
|
@@ -1028,15 +1035,7 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
var newcol = new TreeGridTextColumn();
|
|
|
newcol.TextWrapping = TextWrapping.NoWrap;
|
|
|
|
|
|
- newcol.TextAlignment = txtCol.Alignment == Alignment.NotSet
|
|
|
- ? TextAlignment.Left
|
|
|
- : txtCol.Alignment == Alignment.BottomLeft || txtCol.Alignment == Alignment.MiddleLeft ||
|
|
|
- txtCol.Alignment == Alignment.TopLeft
|
|
|
- ? TextAlignment.Left
|
|
|
- : txtCol.Alignment == Alignment.BottomCenter || txtCol.Alignment == Alignment.MiddleCenter ||
|
|
|
- txtCol.Alignment == Alignment.TopCenter
|
|
|
- ? TextAlignment.Center
|
|
|
- : TextAlignment.Right;
|
|
|
+ newcol.TextAlignment = txtCol.Alignment.TextAlignment(typeof(string));
|
|
|
|
|
|
newcol.AllowEditing = false;
|
|
|
newcol.UpdateTrigger = UpdateSourceTrigger.PropertyChanged;
|
|
@@ -1349,15 +1348,18 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
|
|
|
private object? CalculateSummaryData(IDynamicGridSummary summary, DynamicColumnBase column)
|
|
|
{
|
|
|
+ var nodes = _tree.View is not null
|
|
|
+ ? _tree.View.Nodes.Select(x => x.Item as CoreTreeNode).NotNull()
|
|
|
+ : Nodes.Nodes;
|
|
|
if(summary is DynamicGridCountSummary count)
|
|
|
{
|
|
|
- return string.Format("{0:N0}", _tree.View.Nodes.Count);
|
|
|
+ return string.Format("{0:N0}", nodes.Count());
|
|
|
}
|
|
|
else if(summary is DynamicGridSumSummary sum)
|
|
|
{
|
|
|
if(column is DynamicGridColumn gridColumn)
|
|
|
{
|
|
|
- var data = _tree.View.Nodes.Select(x => MapRow((x.Item as CoreTreeNode)?.Row)).NotNull()
|
|
|
+ var data = nodes.Select(x => MapRow(x.Row)).NotNull()
|
|
|
.Select(x => x[gridColumn.ColumnName]);
|
|
|
|
|
|
object? result;
|
|
@@ -1385,7 +1387,7 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
}
|
|
|
else if(summary is DynamicGridCustomSummary custom)
|
|
|
{
|
|
|
- var data = _tree.View.Nodes.Select(x => MapRow((x.Item as CoreTreeNode)?.Row)).NotNull();
|
|
|
+ var data = nodes.Select(x => MapRow(x.Row)).NotNull();
|
|
|
var result = custom.Aggregate(data);
|
|
|
if(result is not null)
|
|
|
{
|
|
@@ -1549,6 +1551,8 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
var coreTreeNode = Nodes.Find(_innerRow);
|
|
|
coreTreeNode?.InvalidateData();
|
|
|
|
|
|
+ CalculateSummaries();
|
|
|
+
|
|
|
_invalidating = false;
|
|
|
}
|
|
|
|