|
@@ -300,6 +300,12 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
#region Events
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Called when an item is selected in the grid. It is not called if <see cref="IsReady"/> is not <see langword="true"/>.
|
|
|
+ /// </summary>
|
|
|
+ /// <remarks>
|
|
|
+ /// It is unnecessary to use this if within a grid. Instead, override <see cref="SelectItems(CoreRow[]?)"/>.
|
|
|
+ /// </remarks>
|
|
|
public event SelectItemHandler? OnSelectItem;
|
|
|
|
|
|
public event OnCellDoubleClick? OnCellDoubleClick;
|
|
@@ -638,6 +644,10 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
private void DataGrid_SelectionChanged(object? sender, GridSelectionChangedEventArgs e)
|
|
|
{
|
|
|
+ if(IsReady && !bRefreshing)
|
|
|
+ {
|
|
|
+ StartTimer();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public bool IsReady { get; private set; }
|
|
@@ -826,22 +836,22 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
private void DataGrid_PreviewKeyUp(object sender, KeyEventArgs e)
|
|
|
{
|
|
|
- if (e.Key == Key.OemPeriod)
|
|
|
- {
|
|
|
- var editor = e.OriginalSource as TimeSpanEdit;
|
|
|
- if (editor != null && editor.SelectionStart < 2) editor.SelectionStart = 3;
|
|
|
- }
|
|
|
- else if (e.Key == Key.Tab)
|
|
|
- {
|
|
|
- if (IsDirectEditMode())
|
|
|
+ if (e.Key == Key.OemPeriod)
|
|
|
{
|
|
|
- DataGrid.SelectionController.CurrentCellManager.EndEdit();
|
|
|
- DataGrid.MoveFocus(new TraversalRequest(FocusNavigationDirection.Right));
|
|
|
- DataGrid.SelectionController.CurrentCellManager.BeginEdit();
|
|
|
- e.Handled = true;
|
|
|
+ var editor = e.OriginalSource as TimeSpanEdit;
|
|
|
+ if (editor != null && editor.SelectionStart < 2) editor.SelectionStart = 3;
|
|
|
}
|
|
|
- }
|
|
|
- //throw new NotImplementedException();
|
|
|
+ else if (e.Key == Key.Tab)
|
|
|
+ {
|
|
|
+ if (IsDirectEditMode())
|
|
|
+ {
|
|
|
+ DataGrid.SelectionController.CurrentCellManager.EndEdit();
|
|
|
+ DataGrid.MoveFocus(new TraversalRequest(FocusNavigationDirection.Right));
|
|
|
+ DataGrid.SelectionController.CurrentCellManager.BeginEdit();
|
|
|
+ e.Handled = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //throw new NotImplementedException();
|
|
|
}
|
|
|
|
|
|
private void DataGrid_CurrentCellRequestNavigate(object? sender, CurrentCellRequestNavigateEventArgs e)
|
|
@@ -1268,6 +1278,10 @@ namespace InABox.DynamicGrid
|
|
|
set => SetSelectedRows(value);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Call the <see cref="OnSelectItem"/> event, and do any updating which needs to occur when items are selected.
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="rows"></param>
|
|
|
protected virtual void SelectItems(CoreRow[]? rows)
|
|
|
{
|
|
|
if (IsReady)
|
|
@@ -1299,11 +1313,6 @@ namespace InABox.DynamicGrid
|
|
|
{
|
|
|
if (sender != DataGrid) return;
|
|
|
|
|
|
- if (!bFilterVisible && !bSwallowKey && DataGrid.SelectedIndex > -1)
|
|
|
- {
|
|
|
- //Logger.Send(LogType.Information, "", String.Format("{0}: KeyUp -> {1}", this.GetType().EntityName(), SelectedRows.Length));
|
|
|
- SelectItems(SelectedRows);
|
|
|
- }
|
|
|
bSwallowKey = false;
|
|
|
|
|
|
if (IsSequenced)
|
|
@@ -1436,7 +1445,7 @@ namespace InABox.DynamicGrid
|
|
|
if (IsDirectEditMode())
|
|
|
return;
|
|
|
|
|
|
- SelectItems(SelectedRows);
|
|
|
+ //SelectItems(SelectedRows);
|
|
|
var args = new HandledEventArgs(false);
|
|
|
OnDoubleClick?.Invoke(sender, args);
|
|
|
if (args.Handled)
|
|
@@ -2127,7 +2136,6 @@ namespace InABox.DynamicGrid
|
|
|
cursor.Dispose();
|
|
|
cursor = null;
|
|
|
}
|
|
|
- bRefreshing = false;
|
|
|
}
|
|
|
|
|
|
protected override bool OnBeforeRefresh()
|