|
@@ -5,11 +5,9 @@ using System.Collections.ObjectModel;
|
|
|
using System.ComponentModel;
|
|
|
using System.Data;
|
|
|
using System.Diagnostics;
|
|
|
-using System.Drawing;
|
|
|
using System.Globalization;
|
|
|
using System.Linq;
|
|
|
using System.Linq.Expressions;
|
|
|
-using System.Reflection;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
@@ -21,35 +19,25 @@ using System.Windows.Media.Imaging;
|
|
|
using System.Windows.Threading;
|
|
|
using InABox.Clients;
|
|
|
using InABox.Core;
|
|
|
-using InABox.Scripting;
|
|
|
using InABox.WPF;
|
|
|
using Syncfusion.Data;
|
|
|
using Syncfusion.UI.Xaml.Grid;
|
|
|
using Syncfusion.UI.Xaml.Grid.Cells;
|
|
|
using Syncfusion.UI.Xaml.Grid.Helpers;
|
|
|
-using Syncfusion.Windows.Controls.Cells;
|
|
|
-using Syncfusion.Windows.Controls.Grid;
|
|
|
using Syncfusion.Windows.Shared;
|
|
|
-using Syncfusion.Windows.Tools;
|
|
|
-using Syncfusion.Windows.Tools.Controls;
|
|
|
-using Syncfusion.XPS;
|
|
|
using Brush = System.Windows.Media.Brush;
|
|
|
using Color = System.Drawing.Color;
|
|
|
using DataColumn = System.Data.DataColumn;
|
|
|
using DataRow = System.Data.DataRow;
|
|
|
using FilterElement = Syncfusion.UI.Xaml.Grid.FilterElement;
|
|
|
using FontStyle = System.Windows.FontStyle;
|
|
|
-using Geometry = System.Windows.Media.Geometry;
|
|
|
using GridCellToolTipOpeningEventArgs = Syncfusion.UI.Xaml.Grid.GridCellToolTipOpeningEventArgs;
|
|
|
using GridFilterEventArgs = Syncfusion.UI.Xaml.Grid.GridFilterEventArgs;
|
|
|
using GridSelectionMode = Syncfusion.UI.Xaml.Grid.GridSelectionMode;
|
|
|
using Image = System.Windows.Controls.Image;
|
|
|
-using Path = System.Windows.Shapes.Path;
|
|
|
-using Point = System.Windows.Point;
|
|
|
using RowColumnIndex = Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex;
|
|
|
using SolidColorBrush = System.Windows.Media.SolidColorBrush;
|
|
|
using String = System.String;
|
|
|
-using Transform = System.Windows.Media.Transform;
|
|
|
using VirtualizingCellsControl = Syncfusion.UI.Xaml.Grid.VirtualizingCellsControl;
|
|
|
|
|
|
namespace InABox.DynamicGrid
|
|
@@ -356,6 +344,7 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
private readonly Button Cut;
|
|
|
private readonly SfDataGrid DataGrid;
|
|
|
+ private readonly Border Disabler;
|
|
|
|
|
|
private readonly Button Delete;
|
|
|
private readonly DockPanel Docker;
|
|
@@ -401,12 +390,12 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
public event OnCellDoubleClick? OnCellDoubleClick;
|
|
|
|
|
|
- public event OnGridChanged? OnChanged;
|
|
|
+ public event EventHandler? OnChanged;
|
|
|
|
|
|
public delegate void BeforeSelectionEvent(CancelEventArgs cancel);
|
|
|
public event BeforeSelectionEvent? OnBeforeSelection;
|
|
|
|
|
|
- public void DoChanged() => OnChanged?.Invoke(this);
|
|
|
+ public void DoChanged() => OnChanged?.Invoke(this, EventArgs.Empty);
|
|
|
|
|
|
public event EditorValueChangedHandler? OnEditorValueChanged;
|
|
|
|
|
@@ -476,7 +465,7 @@ namespace InABox.DynamicGrid
|
|
|
CellFontWeightConverter = new DynamicGridCellStyleConverter<System.Windows.FontWeight?>(this, GetCellFontWeight);
|
|
|
|
|
|
VisibleColumns = new DynamicGridColumns();
|
|
|
-
|
|
|
+
|
|
|
DataGrid = new SfDataGrid();
|
|
|
DataGrid.VerticalAlignment = VerticalAlignment.Stretch;
|
|
|
DataGrid.HorizontalAlignment = HorizontalAlignment.Stretch;
|
|
@@ -665,15 +654,33 @@ namespace InABox.DynamicGrid
|
|
|
Layout.Children.Add(DataGrid);
|
|
|
Layout.Children.Add(Loading);
|
|
|
Layout.Children.Add(Docker);
|
|
|
+
|
|
|
+ Disabler = new Border()
|
|
|
+ {
|
|
|
+ BorderBrush = new SolidColorBrush(Colors.Transparent),
|
|
|
+ Background = new SolidColorBrush(Colors.DimGray) { Opacity = 0.2 },
|
|
|
+ Visibility = Visibility.Collapsed,
|
|
|
+ };
|
|
|
+ Disabler.SetValue(Canvas.ZIndexProperty, 99);
|
|
|
+ Disabler.SetValue(Grid.RowSpanProperty, 3);
|
|
|
|
|
|
+ Layout.Children.Add(Disabler);
|
|
|
+
|
|
|
//Scroll.ApplyTemplate();
|
|
|
|
|
|
Content = Layout;
|
|
|
|
|
|
+ IsEnabledChanged += (sender, args) =>
|
|
|
+ {
|
|
|
+ Disabler.Visibility = Equals(args.NewValue, true)
|
|
|
+ ? Visibility.Collapsed
|
|
|
+ : Visibility.Visible;
|
|
|
+ };
|
|
|
+
|
|
|
Init();
|
|
|
Reconfigure();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
protected virtual void BeforeSelection(CancelEventArgs cancel)
|
|
|
{
|
|
|
OnBeforeSelection?.Invoke(cancel);
|
|
@@ -1052,6 +1059,7 @@ namespace InABox.DynamicGrid
|
|
|
bChanged = false;
|
|
|
inplaceeditor = null;
|
|
|
DataGridItems?.AcceptChanges();
|
|
|
+ DoChanged();
|
|
|
}
|
|
|
|
|
|
private void UpdateData(T obj, String mappedname)
|
|
@@ -1114,6 +1122,8 @@ namespace InABox.DynamicGrid
|
|
|
row[string.Format("ActionColumn{0}", i)] = ActionColumns[i].Data(corerow);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
|
|
|
private void DataGrid_QueryRowHeight(object? sender, QueryRowHeightEventArgs e)
|
|
|
{
|
|
@@ -1133,6 +1143,8 @@ namespace InABox.DynamicGrid
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
#region Row Selections
|
|
|
|
|
|
protected CoreRow[] GetVisibleRows()
|
|
@@ -2557,7 +2569,7 @@ namespace InABox.DynamicGrid
|
|
|
{
|
|
|
DeleteItems(rows);
|
|
|
SelectedRows = Array.Empty<CoreRow>();
|
|
|
- OnChanged?.Invoke(this);
|
|
|
+ OnChanged?.Invoke(this, EventArgs.Empty);
|
|
|
Refresh(false, true);
|
|
|
SelectItems(null);
|
|
|
}
|
|
@@ -2723,12 +2735,12 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
InvalidateGrid();
|
|
|
SelectedRows = new[] { datarow };
|
|
|
- OnChanged?.Invoke(this);
|
|
|
+ OnChanged?.Invoke(this, EventArgs.Empty);
|
|
|
}
|
|
|
else if (AddEditClick(null))
|
|
|
{
|
|
|
Refresh(false, true);
|
|
|
- OnChanged?.Invoke(this);
|
|
|
+ OnChanged?.Invoke(this, EventArgs.Empty);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3034,7 +3046,7 @@ namespace InABox.DynamicGrid
|
|
|
Data.Rows.Add(row);
|
|
|
InvalidateGrid();
|
|
|
SelectedRows = new[] { row };
|
|
|
- OnChanged?.Invoke(this);
|
|
|
+ OnChanged?.Invoke(this, EventArgs.Empty);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -3060,7 +3072,7 @@ namespace InABox.DynamicGrid
|
|
|
ObjectToRow(items[i], rows[i]);
|
|
|
InvalidateGrid();
|
|
|
SelectedRows = sel;
|
|
|
- OnChanged?.Invoke(this);
|
|
|
+ OnChanged?.Invoke(this, EventArgs.Empty);
|
|
|
return true;
|
|
|
}
|
|
|
|