|
@@ -57,13 +57,11 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
|
|
|
Parent.AddHiddenColumn(IDColumn.Property);
|
|
|
Parent.AddHiddenColumn(ParentColumn.Property);
|
|
|
- Parent.AddHiddenColumn(DescriptionColumn.Property);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private Column<T> IDColumn;
|
|
|
private Column<T> ParentColumn;
|
|
|
- private Column<T> DescriptionColumn;
|
|
|
|
|
|
private ContextMenu _menu;
|
|
|
private SfTreeGrid _tree;
|
|
@@ -84,6 +82,28 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private bool _showHeader = false;
|
|
|
+ public bool ShowHeader
|
|
|
+ {
|
|
|
+ get => _showHeader;
|
|
|
+ set
|
|
|
+ {
|
|
|
+ _showHeader = value;
|
|
|
+ _tree.HeaderRowHeight = value ? 30 : 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool _autoSizeExpander = false;
|
|
|
+ public bool AutoSizeExpander
|
|
|
+ {
|
|
|
+ get => _autoSizeExpander;
|
|
|
+ set
|
|
|
+ {
|
|
|
+ _autoSizeExpander = value;
|
|
|
+ _tree.AllowAutoSizingExpanderColumn = value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private DynamicTreeGridLines _gridLines = DynamicTreeGridLines.Both;
|
|
|
public DynamicTreeGridLines GridLines
|
|
|
{
|
|
@@ -166,11 +186,10 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
protected virtual FontWeight? GetCellFontWeight(CoreRow row, String columnname) => null;
|
|
|
|
|
|
|
|
|
- public DynamicGridTreeUIComponent(Expression<Func<T, Guid>> idColumn, Expression<Func<T, Guid>> parentIDColumn, Expression<Func<T, string>> descriptionColumn)
|
|
|
+ public DynamicGridTreeUIComponent(Expression<Func<T, Guid>> idColumn, Expression<Func<T, Guid>> parentIDColumn)
|
|
|
{
|
|
|
IDColumn = new Column<T>(CoreUtils.GetFullPropertyName(idColumn, "."));
|
|
|
ParentColumn = new Column<T>(CoreUtils.GetFullPropertyName(parentIDColumn, "."));
|
|
|
- DescriptionColumn = new Column<T>(CoreUtils.GetFullPropertyName(descriptionColumn, "."));
|
|
|
|
|
|
ColumnsMenu = new ContextMenu();
|
|
|
ColumnsMenu.Opened += ColumnsMenu_ContextMenuOpening;
|
|
@@ -179,7 +198,7 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
_tree.ChildPropertyName = "Children";
|
|
|
//_tree.ParentPropertyName = "Parent";
|
|
|
_tree.AutoGenerateColumns = false;
|
|
|
- ExpandMode = ExpandMode.All;
|
|
|
+ ExpandMode = DynamicTreeGridExpandMode.All;
|
|
|
//_tree.NodeCollapsing += (o, e) => { e.Cancel = true; };
|
|
|
//_tree.HeaderRowHeight = 0D;
|
|
|
_tree.HeaderRowHeight = 30;
|
|
@@ -220,6 +239,8 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
_tree.RowHeight = 30D;
|
|
|
_tree.SetValue(Grid.RowProperty, 0);
|
|
|
|
|
|
+ _tree.SetValue(ScrollViewer.VerticalScrollBarVisibilityProperty, ScrollBarVisibility.Visible);
|
|
|
+
|
|
|
_tree.AllowDraggingRows = false;
|
|
|
_tree.Drop += _tree_Drop;
|
|
|
_tree.DragOver += _tree_DragOver;
|
|
@@ -241,7 +262,7 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
|
|
|
public IEnumerable<CoreRow> GetChildren(Guid id)
|
|
|
{
|
|
|
- return Nodes.GetChildren(id).Select(x => MapRow(x.Row));
|
|
|
+ return Nodes.GetChildren(id).Select(x => MapRow(x.Row)).NotNull();
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
@@ -902,8 +923,7 @@ public class DynamicGridTreeUIComponent<T> : IDynamicGridUIComponent<T>, IDynami
|
|
|
|
|
|
var _id = row.Get<Guid>(IDColumn.Property);
|
|
|
var _parent = row.Get<Guid>(ParentColumn.Property);
|
|
|
- var _description = row.Get<string>(DescriptionColumn.Property);
|
|
|
- nodes.Add(_id, _parent, newRow).Description = _description;
|
|
|
+ nodes.Add(_id, _parent, newRow);
|
|
|
}
|
|
|
Nodes = nodes;
|
|
|
_tree.ItemsSource = nodes.Nodes;
|