|
|
|
@ -729,6 +729,8 @@ namespace Avalonia.Controls |
|
|
|
RowDetailsTemplateProperty.Changed.AddClassHandler<DataGrid>((x, e) => x.OnRowDetailsTemplateChanged(e)); |
|
|
|
RowDetailsVisibilityModeProperty.Changed.AddClassHandler<DataGrid>((x, e) => x.OnRowDetailsVisibilityModeChanged(e)); |
|
|
|
AutoGenerateColumnsProperty.Changed.AddClassHandler<DataGrid>((x, e) => x.OnAutoGenerateColumnsChanged(e)); |
|
|
|
|
|
|
|
FocusableProperty.OverrideDefaultValue<DataGrid>(true); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -2478,7 +2480,7 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
if (_hScrollBar != null) |
|
|
|
{ |
|
|
|
//_hScrollBar.IsTabStop = false;
|
|
|
|
_hScrollBar.IsTabStop = false; |
|
|
|
_hScrollBar.Maximum = 0.0; |
|
|
|
_hScrollBar.Orientation = Orientation.Horizontal; |
|
|
|
_hScrollBar.IsVisible = false; |
|
|
|
@ -2494,7 +2496,7 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
if (_vScrollBar != null) |
|
|
|
{ |
|
|
|
//_vScrollBar.IsTabStop = false;
|
|
|
|
_vScrollBar.IsTabStop = false; |
|
|
|
_vScrollBar.Maximum = 0.0; |
|
|
|
_vScrollBar.Orientation = Orientation.Vertical; |
|
|
|
_vScrollBar.IsVisible = false; |
|
|
|
@ -3734,7 +3736,7 @@ namespace Avalonia.Controls |
|
|
|
if (sender is Control editingElement) |
|
|
|
{ |
|
|
|
editingElement.LostFocus -= EditingElement_LostFocus; |
|
|
|
if (EditingRow != null && EditingColumnIndex != -1) |
|
|
|
if (EditingRow != null && _editingColumnIndex != -1) |
|
|
|
{ |
|
|
|
FocusEditingCell(true); |
|
|
|
} |
|
|
|
@ -4039,18 +4041,22 @@ namespace Avalonia.Controls |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
Debug.Assert(EditingRow != null); |
|
|
|
var editingRow = EditingRow; |
|
|
|
if (editingRow is null) |
|
|
|
{ |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
Debug.Assert(_editingColumnIndex >= 0); |
|
|
|
Debug.Assert(_editingColumnIndex < ColumnsItemsInternal.Count); |
|
|
|
Debug.Assert(_editingColumnIndex == CurrentColumnIndex); |
|
|
|
Debug.Assert(EditingRow != null && EditingRow.Slot == CurrentSlot); |
|
|
|
|
|
|
|
// Cache these to see if they change later
|
|
|
|
int currentSlot = CurrentSlot; |
|
|
|
int currentColumnIndex = CurrentColumnIndex; |
|
|
|
|
|
|
|
// We're ready to start ending, so raise the event
|
|
|
|
DataGridCell editingCell = EditingRow.Cells[_editingColumnIndex]; |
|
|
|
DataGridCell editingCell = editingRow.Cells[_editingColumnIndex]; |
|
|
|
var editingElement = editingCell.Content as Control; |
|
|
|
if (editingElement == null) |
|
|
|
{ |
|
|
|
@ -4058,7 +4064,7 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
if (raiseEvents) |
|
|
|
{ |
|
|
|
DataGridCellEditEndingEventArgs e = new DataGridCellEditEndingEventArgs(CurrentColumn, EditingRow, editingElement, editAction); |
|
|
|
DataGridCellEditEndingEventArgs e = new DataGridCellEditEndingEventArgs(CurrentColumn, editingRow, editingElement, editAction); |
|
|
|
OnCellEditEnding(e); |
|
|
|
if (e.Cancel) |
|
|
|
{ |
|
|
|
@ -4112,7 +4118,7 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (EditingRow != null) |
|
|
|
if (editingRow != null) |
|
|
|
{ |
|
|
|
if (editingCell.IsValid) |
|
|
|
{ |
|
|
|
@ -4120,10 +4126,10 @@ namespace Avalonia.Controls |
|
|
|
editingCell.UpdatePseudoClasses(); |
|
|
|
} |
|
|
|
|
|
|
|
if (EditingRow.IsValid) |
|
|
|
if (editingRow.IsValid) |
|
|
|
{ |
|
|
|
EditingRow.IsValid = false; |
|
|
|
EditingRow.UpdatePseudoClasses(); |
|
|
|
editingRow.IsValid = false; |
|
|
|
editingRow.UpdatePseudoClasses(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -4169,22 +4175,22 @@ namespace Avalonia.Controls |
|
|
|
PopulateCellContent( |
|
|
|
isCellEdited: !exitEditingMode, |
|
|
|
dataGridColumn: CurrentColumn, |
|
|
|
dataGridRow: EditingRow, |
|
|
|
dataGridRow: editingRow, |
|
|
|
dataGridCell: editingCell); |
|
|
|
|
|
|
|
EditingRow.InvalidateDesiredHeight(); |
|
|
|
editingRow.InvalidateDesiredHeight(); |
|
|
|
var column = editingCell.OwningColumn; |
|
|
|
if (column.Width.IsSizeToCells || column.Width.IsAuto) |
|
|
|
{// Invalidate desired width and force recalculation
|
|
|
|
column.SetWidthDesiredValue(0); |
|
|
|
EditingRow.OwningGrid.AutoSizeColumn(column, editingCell.DesiredSize.Width); |
|
|
|
editingRow.OwningGrid.AutoSizeColumn(column, editingCell.DesiredSize.Width); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// We're done, so raise the CellEditEnded event
|
|
|
|
if (raiseEvents) |
|
|
|
{ |
|
|
|
OnCellEditEnded(new DataGridCellEditEndedEventArgs(CurrentColumn, EditingRow, editAction)); |
|
|
|
OnCellEditEnded(new DataGridCellEditEndedEventArgs(CurrentColumn, editingRow, editAction)); |
|
|
|
} |
|
|
|
|
|
|
|
// There's a chance that somebody reopened this cell for edit within the CellEditEnded handler,
|
|
|
|
@ -4427,8 +4433,7 @@ namespace Avalonia.Controls |
|
|
|
dataGridCell.Focus(); |
|
|
|
success = dataGridCell.ContainsFocusedElement(); |
|
|
|
} |
|
|
|
//TODO Check
|
|
|
|
//success = dataGridCell.ContainsFocusedElement() ? true : dataGridCell.Focus();
|
|
|
|
|
|
|
|
_focusEditingControl = !success; |
|
|
|
} |
|
|
|
return success; |
|
|
|
|