|
@@ -10,128 +10,11 @@ using System.Windows.Media;
|
|
|
using System.Windows.Media.Imaging;
|
|
|
using InABox.Core;
|
|
|
using InABox.WPF;
|
|
|
+using Syncfusion.UI.Xaml.Grid;
|
|
|
using Syncfusion.UI.Xaml.TreeGrid;
|
|
|
|
|
|
namespace InABox.DynamicGrid
|
|
|
{
|
|
|
- // public class CoreTreeNode : INotifyPropertyChanged
|
|
|
- // {
|
|
|
- //
|
|
|
- // private CoreTreeNodes _owner;
|
|
|
- //
|
|
|
- // public ObservableCollection<CoreTreeNode> Children => _owner.GetChilden(_id);
|
|
|
- //
|
|
|
- // private Guid _id;
|
|
|
- // public Guid ID
|
|
|
- // {
|
|
|
- // get { return _id; }
|
|
|
- // set
|
|
|
- // {
|
|
|
- // _id = value;
|
|
|
- // RaisedOnPropertyChanged("ID");
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // private Guid _parent;
|
|
|
- // public Guid Parent
|
|
|
- // {
|
|
|
- // get { return _parent; }
|
|
|
- // set
|
|
|
- // {
|
|
|
- // _parent = value;
|
|
|
- // RaisedOnPropertyChanged("Parent");
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // private string _description;
|
|
|
- // public string Description
|
|
|
- // {
|
|
|
- // get { return _description; }
|
|
|
- // set
|
|
|
- // {
|
|
|
- // _description = value;
|
|
|
- // RaisedOnPropertyChanged("Description");
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // private ImageSource? _image;
|
|
|
- // public ImageSource? Image
|
|
|
- // {
|
|
|
- // get { return _image; }
|
|
|
- // set
|
|
|
- // {
|
|
|
- // _image = value;
|
|
|
- // RaisedOnPropertyChanged("Image");
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
- //
|
|
|
- // public void RaisedOnPropertyChanged(string propertyName)
|
|
|
- // {
|
|
|
- // PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
|
- // }
|
|
|
- //
|
|
|
- // public CoreTreeNode(CoreTreeNodes owner)
|
|
|
- // {
|
|
|
- // _owner = owner;
|
|
|
- // _description = "";
|
|
|
- // }
|
|
|
- //
|
|
|
- // public CoreTreeNode(CoreTreeNodes owner, Guid id, Guid parent) : this(owner)
|
|
|
- // {
|
|
|
- // _id = id;
|
|
|
- // _parent = parent;
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // public class CoreTreeNodes
|
|
|
- // {
|
|
|
- //
|
|
|
- // private List<CoreTreeNode> _nodes;
|
|
|
- // public ObservableCollection<CoreTreeNode> Nodes => new ObservableCollection<CoreTreeNode>(_nodes.Where(x => x.Parent == Guid.Empty));
|
|
|
- //
|
|
|
- // public CoreTreeNode? this[Guid id] => _nodes.FirstOrDefault(x => x.ID == id);
|
|
|
- //
|
|
|
- // public CoreTreeNodes()
|
|
|
- // {
|
|
|
- // _nodes = new List<CoreTreeNode>();
|
|
|
- // }
|
|
|
- //
|
|
|
- // public CoreTreeNode Add(Guid id, Guid parent)
|
|
|
- // {
|
|
|
- // var node = new CoreTreeNode(this, id, parent);
|
|
|
- // _nodes.Add(node);
|
|
|
- // return node;
|
|
|
- // }
|
|
|
- //
|
|
|
- // public void GetChildren(List<Guid> nodes, Guid id)
|
|
|
- // {
|
|
|
- // nodes.Add(id);
|
|
|
- // var children = GetChilden(id);
|
|
|
- // foreach (var child in children)
|
|
|
- // GetChildren(nodes, child.ID);
|
|
|
- // }
|
|
|
- //
|
|
|
- // public ObservableCollection<CoreTreeNode> GetChilden(Guid id)
|
|
|
- // {
|
|
|
- //
|
|
|
- // return new ObservableCollection<CoreTreeNode>(_nodes.Where(x => x.Parent.Equals(id) && (x.ID != id)));
|
|
|
- // }
|
|
|
- //
|
|
|
- // public void Load<T>(CoreTable table, Expression<Func<T, Guid>> id, Expression<Func<T, Guid>> parentid, Expression<Func<T, String>> description)
|
|
|
- // {
|
|
|
- // _nodes.Clear();
|
|
|
- // foreach (var row in table.Rows)
|
|
|
- // {
|
|
|
- // Guid _id = row.Get<T, Guid>(id);
|
|
|
- // Guid _parent = row.Get<T, Guid>(parentid);
|
|
|
- // String _description = row.Get<T, String>(description);
|
|
|
- // Add(_id, _parent).Description = _description;
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // }
|
|
|
|
|
|
public enum DynamicTreeOption
|
|
|
{
|
|
@@ -140,6 +23,14 @@ namespace InABox.DynamicGrid
|
|
|
Delete
|
|
|
}
|
|
|
|
|
|
+ public enum DynamicTreeGridLines
|
|
|
+ {
|
|
|
+ Both,
|
|
|
+ Horizontal,
|
|
|
+ Vertical,
|
|
|
+ None
|
|
|
+ }
|
|
|
+
|
|
|
public delegate void OnSelectItem(CoreTreeNode node);
|
|
|
|
|
|
public delegate void OnContextMenuOpening(CoreTreeNode node, ContextMenu menu);
|
|
@@ -199,6 +90,23 @@ namespace InABox.DynamicGrid
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private DynamicTreeGridLines _gridLines = DynamicTreeGridLines.Both;
|
|
|
+ public DynamicTreeGridLines GridLines
|
|
|
+ {
|
|
|
+ get => _gridLines;
|
|
|
+ set
|
|
|
+ {
|
|
|
+ _gridLines = value;
|
|
|
+ _tree.GridLinesVisibility = value switch
|
|
|
+ {
|
|
|
+ DynamicTreeGridLines.Both => GridLinesVisibility.Both,
|
|
|
+ DynamicTreeGridLines.Horizontal => GridLinesVisibility.Horizontal,
|
|
|
+ DynamicTreeGridLines.Vertical => GridLinesVisibility.Vertical,
|
|
|
+ _ => GridLinesVisibility.None
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/*public double RowHeight
|
|
|
{
|
|
|
get => _tree.RowHeight;
|