|
@@ -21,6 +21,7 @@ using System.Windows.Input;
|
|
|
using System.Windows.Media;
|
|
|
using System.Windows.Media.Imaging;
|
|
|
using Syncfusion.UI.Xaml.TreeGrid.Filtering;
|
|
|
+using Syncfusion.UI.Xaml.TreeGrid.Cells;
|
|
|
|
|
|
namespace InABox.DynamicGrid;
|
|
|
|
|
@@ -596,6 +597,29 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
|
|
|
#region Columns
|
|
|
|
|
|
+ private class StackedHeaderRenderer : TreeGridStackedHeaderCellRenderer
|
|
|
+ {
|
|
|
+ private Style Style;
|
|
|
+
|
|
|
+ public StackedHeaderRenderer()
|
|
|
+ {
|
|
|
+ var headstyle = new Style(typeof(TreeGridStackedHeaderCell));
|
|
|
+ headstyle.Setters.Add(new Setter(Control.BackgroundProperty, new SolidColorBrush(Colors.Gainsboro)));
|
|
|
+ headstyle.Setters.Add(new Setter(Control.ForegroundProperty, new SolidColorBrush(Colors.Black)));
|
|
|
+ headstyle.Setters.Add(new Setter(Control.FontSizeProperty, 12D));
|
|
|
+ headstyle.Setters.Add(new Setter(Control.BorderThicknessProperty, new Thickness(0.0, 0.0, 0, 0)));
|
|
|
+ headstyle.Setters.Add(new Setter(Control.MarginProperty, new Thickness(0, 0, 0.75, 0.75)));
|
|
|
+
|
|
|
+ Style = headstyle;
|
|
|
+ }
|
|
|
+
|
|
|
+ public override void OnInitializeEditElement(TreeDataColumnBase dataColumn, TreeGridStackedHeaderCell uiElement, object dataContext)
|
|
|
+ {
|
|
|
+ uiElement.Style = Style;
|
|
|
+ base.OnInitializeEditElement(dataColumn, uiElement, dataContext);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private readonly List<DynamicColumnBase> ColumnList = new();
|
|
|
|
|
|
private List<DynamicActionColumn> ActionColumns = new();
|
|
@@ -628,9 +652,9 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public class TemplateColumnSelector(DynamicGridTreeUIComponent<T> parent, Func<CoreRow, FrameworkElement> dataTemplate) : DataTemplateSelector
|
|
|
+ public class TemplateColumnSelector(DynamicGridTreeUIComponent<T> parent, Func<CoreRow, FrameworkElement?> dataTemplate) : DataTemplateSelector
|
|
|
{
|
|
|
- public Func<CoreRow, FrameworkElement> DataTemplate { get; init; } = dataTemplate;
|
|
|
+ public Func<CoreRow, FrameworkElement?> DataTemplate { get; init; } = dataTemplate;
|
|
|
|
|
|
public DynamicGridTreeUIComponent<T> Parent { get; init; } = parent;
|
|
|
|
|
@@ -679,6 +703,7 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
newcol.Padding = new Thickness(4);
|
|
|
newcol.ColumnSizer = TreeColumnSizer.None;
|
|
|
newcol.HeaderText = column.HeaderText;
|
|
|
+ newcol.MappingName = sColName;
|
|
|
|
|
|
ApplyFilterStyle(newcol, false, true);
|
|
|
|
|
@@ -783,6 +808,7 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
newcol.AllowSorting = false;
|
|
|
newcol.ShowToolTip = false;
|
|
|
newcol.ShowHeaderToolTip = false;
|
|
|
+ newcol.MappingName = sColName;
|
|
|
|
|
|
ApplyFilterStyle(newcol, false, true);
|
|
|
|
|
@@ -906,6 +932,11 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
|
|
|
_tree.StackedHeaderRows.Add(row);
|
|
|
}
|
|
|
+ if(groupings.Count > 0)
|
|
|
+ {
|
|
|
+ _tree.CellRenderers.Remove("StackedHeader");
|
|
|
+ _tree.CellRenderers.Add("StackedHeader", new StackedHeaderRenderer());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void RefreshColumns(DynamicGridColumns columns, DynamicActionColumns actionColumns, DynamicGridColumnGroupings groupings)
|