|
@@ -22,6 +22,7 @@ using InABox.Clients;
|
|
|
using InABox.Core;
|
|
|
using InABox.Scripting;
|
|
|
using InABox.WPF;
|
|
|
+using NPOI.SS.Formula.Functions;
|
|
|
using Syncfusion.Data;
|
|
|
using Syncfusion.UI.Xaml.Grid;
|
|
|
using Syncfusion.UI.Xaml.Grid.Cells;
|
|
@@ -352,6 +353,8 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
public event OnDoubleClick? OnDoubleClick;
|
|
|
|
|
|
+ public event OnCellDoubleClick? OnCellDoubleClick;
|
|
|
+
|
|
|
public OnGridChanged? OnChanged;
|
|
|
|
|
|
public event EditorValueChangedHandler? OnEditorValueChanged;
|
|
@@ -757,6 +760,17 @@ namespace InABox.DynamicGrid
|
|
|
{ DisplayText = x, ActualValue = x, IsSelected = column.SelectedFilters == null || column.SelectedFilters.Contains(x) });
|
|
|
}
|
|
|
|
|
|
+ private CoreRow? GetRowFromIndex(int rowIndex)
|
|
|
+ {
|
|
|
+ var row = rowIndex - (Options.Contains(DynamicGridOption.FilterRows) ? 2 : 1);
|
|
|
+ if (row < 0)
|
|
|
+ return null;
|
|
|
+ row = DataGridItems.Rows.IndexOf((DataGrid.View.Records[row].Data as DataRowView)!.Row);
|
|
|
+ if (row < 0)
|
|
|
+ return null;
|
|
|
+ return Data.Rows[row];
|
|
|
+ }
|
|
|
+
|
|
|
private void DataGrid_CellToolTipOpening(object? sender, GridCellToolTipOpeningEventArgs e)
|
|
|
{
|
|
|
if (ColumnList[e.RowColumnIndex.ColumnIndex] is not DynamicActionColumn col)
|
|
@@ -765,15 +779,12 @@ namespace InABox.DynamicGrid
|
|
|
if (toolTip is null)
|
|
|
return;
|
|
|
|
|
|
- var row = e.RowColumnIndex.RowIndex - (Options.Contains(DynamicGridOption.FilterRows) ? 2 : 1);
|
|
|
- if (row < 0)
|
|
|
- return;
|
|
|
- row = DataGridItems.Rows.IndexOf((DataGrid.View.Records[row].Data as DataRowView)!.Row);
|
|
|
- if (row < 0)
|
|
|
+ var row = GetRowFromIndex(e.RowColumnIndex.RowIndex);
|
|
|
+ if (row is null)
|
|
|
return;
|
|
|
e.ToolTip.Template = TemplateGenerator.CreateControlTemplate(
|
|
|
typeof(ToolTip),
|
|
|
- () => toolTip.Invoke(col, Data.Rows[row])
|
|
|
+ () => toolTip.Invoke(col, row)
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -1181,6 +1192,16 @@ namespace InABox.DynamicGrid
|
|
|
private void DataGrid_CellDoubleTapped(object? sender, GridCellDoubleTappedEventArgs e)
|
|
|
{
|
|
|
StopTimer();
|
|
|
+
|
|
|
+ if(OnCellDoubleClick is not null && ColumnList[e.RowColumnIndex.ColumnIndex] is DynamicGridColumn column)
|
|
|
+ {
|
|
|
+ var row = GetRowFromIndex(e.RowColumnIndex.RowIndex);
|
|
|
+ var args = new DynamicGridCellClickEventArgs(row, column);
|
|
|
+ OnCellDoubleClick?.Invoke(this, args);
|
|
|
+ if (args.Handled)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (e.Record != null)
|
|
|
DoDoubleClick(this);
|
|
|
}
|
|
@@ -1189,7 +1210,7 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
#region Column Handling
|
|
|
|
|
|
- private readonly List<object> ColumnList = new();
|
|
|
+ private readonly List<DynamicColumnBase> ColumnList = new();
|
|
|
|
|
|
protected virtual DynamicGridColumns LoadColumns()
|
|
|
{
|