Remove Unused properties

This commit is contained in:
CHINBOY
2025-05-30 14:04:30 +08:00
parent ce0a338e19
commit 974eb785b0
5 changed files with 16 additions and 61 deletions
@@ -246,11 +246,6 @@ public abstract partial class DataGridColumn
result[!ContentControl.ContentProperty] = this[!HeaderProperty];
result[!ContentControl.ContentTemplateProperty] = this[!HeaderTemplateProperty];
result[!DataGridColumnHeader.SizeTypeProperty] = OwningGrid[!DataGrid.SizeTypeProperty];
// TODO 需要审查,原则上我们 AtomUI 是不允许整体自定义的
if (OwningGrid.ColumnHeaderTheme is { } columnTheme)
{
result.SetValue(StyledElement.ThemeProperty, columnTheme, BindingPriority.Template);
}
result.PointerPressed += (s, e) => { HeaderPointerPressed?.Invoke(this, e); };
result.PointerReleased += (s, e) => { HeaderPointerReleased?.Invoke(this, e); };
@@ -735,11 +735,6 @@ public class DataGridColumnHeader : ContentControl
IsEnabled = false,
Content = GetDragIndicatorContent(Content, ContentTemplate)
};
if (OwningGrid.ColumnHeaderTheme is { } columnHeaderTheme)
{
dragIndicator.SetValue(ThemeProperty, columnHeaderTheme, BindingPriority.Template);
}
dragIndicator.PseudoClasses.Add(StdPseudoClass.DragIndicator);
Control? dropLocationIndicator = OwningGrid.DropLocationIndicatorTemplate?.Build();
@@ -293,7 +293,7 @@ public partial class DataGrid
_previousCurrentColumn = CurrentColumn;
_previousCurrentItem = CurrentItem;
OnCurrentCellChanged(EventArgs.Empty);
NotifyCurrentCellChanged(EventArgs.Empty);
}
_flushCurrentCellChanged = false;
@@ -2446,7 +2446,7 @@ public partial class DataGrid
if (raiseEvents)
{
DataGridRowEditEndingEventArgs e = new DataGridRowEditEndingEventArgs(EditingRow, editAction);
OnRowEditEnding(e);
NotifyRowEditEnding(e);
if (e.Cancel)
{
// RowEditEnding has been cancelled
@@ -2494,7 +2494,7 @@ public partial class DataGrid
// Raise the RowEditEnded event
if (raiseEvents)
{
OnRowEditEnded(new DataGridRowEditEndedEventArgs(editingRow, editAction));
NotifyRowEditEnded(new DataGridRowEditEndedEventArgs(editingRow, editAction));
}
return true;
@@ -2575,7 +2575,7 @@ public partial class DataGrid
SelectionChangedEventArgs e = _selectedItems.GetSelectionChangedEventArgs();
if (e.AddedItems.Count > 0 || e.RemovedItems.Count > 0)
{
OnSelectionChanged(e);
NotifySelectionChanged(e);
}
}
}
@@ -2825,7 +2825,7 @@ public partial class DataGrid
Debug.Assert(dataGridColumn != null);
Debug.Assert(_editingEventArgs != null);
_uneditedValue = dataGridColumn.PrepareCellForEditInternal(editingElement, _editingEventArgs);
OnPreparingCellForEdit(new DataGridPreparingCellForEditEventArgs(dataGridColumn, EditingRow, _editingEventArgs,
NotifyPreparingCellForEdit(new DataGridPreparingCellForEditEventArgs(dataGridColumn, EditingRow, _editingEventArgs,
editingElement));
}
@@ -1155,14 +1155,9 @@ public partial class DataGrid
dataGridRow.Slot = slot;
dataGridRow.OwningGrid = this;
dataGridRow.DataContext = dataContext;
if (RowTheme is { } rowTheme)
{
dataGridRow.SetValue(ThemeProperty, rowTheme, BindingPriority.Template);
}
CompleteCellsCollection(dataGridRow);
OnLoadingRow(new DataGridRowEventArgs(dataGridRow));
NotifyLoadingRow(new DataGridRowEventArgs(dataGridRow));
}
return dataGridRow;
@@ -1776,7 +1771,7 @@ public partial class DataGrid
{
if (IsRowRecyclable(row))
{
OnUnloadingRow(new DataGridRowEventArgs(row));
NotifyUnloadingRow(new DataGridRowEventArgs(row));
}
}
// Raise Unloading Row for all the RowGroupHeaders we're displaying
@@ -2155,7 +2150,7 @@ public partial class DataGrid
// Raise UnloadingRow for any row that was visible
if (IsSlotVisible(row.Slot))
{
OnUnloadingRow(new DataGridRowEventArgs(row));
NotifyUnloadingRow(new DataGridRowEventArgs(row));
}
row.DetachFromDataGrid(recycle && row.IsRecyclable /*recycle*/);
@@ -2194,7 +2189,7 @@ public partial class DataGrid
}
// Raise UnloadingRow regardless of whether the row will be recycled
OnUnloadingRow(new DataGridRowEventArgs(dataGridRow));
NotifyUnloadingRow(new DataGridRowEventArgs(dataGridRow));
bool recycleRow = CurrentSlot != dataGridRow.Index;
if (recycleRow)
+7 -37
View File
@@ -75,24 +75,12 @@ public partial class DataGrid : TemplatedControl,
defaultValue: double.NaN,
validate: IsValidColumnHeaderHeight);
/// <summary>
/// Identifies the <see cref="ColumnHeaderTheme"/> dependency property.
/// </summary>
public static readonly StyledProperty<ControlTheme> ColumnHeaderThemeProperty =
AvaloniaProperty.Register<DataGrid, ControlTheme>(nameof(ColumnHeaderTheme));
/// <summary>
/// Identifies the ColumnWidth dependency property.
/// </summary>
public static readonly StyledProperty<DataGridLength> ColumnWidthProperty =
AvaloniaProperty.Register<DataGrid, DataGridLength>(nameof(ColumnWidth), defaultValue: DataGridLength.Auto);
/// <summary>
/// Identifies the <see cref="RowTheme"/> dependency property.
/// </summary>
public static readonly StyledProperty<ControlTheme> RowThemeProperty =
AvaloniaProperty.Register<DataGrid, ControlTheme>(nameof(RowTheme));
/// <summary>
/// Identifies the <see cref="CellTheme"/> dependency property.
/// </summary>
@@ -276,15 +264,6 @@ public partial class DataGrid : TemplatedControl,
set => SetValue(ColumnWidthProperty, value);
}
/// <summary>
/// Gets or sets the theme applied to all rows.
/// </summary>
public ControlTheme RowTheme
{
get => GetValue(RowThemeProperty);
set => SetValue(RowThemeProperty, value);
}
/// <summary>
/// Gets or sets the theme applied to all cells.
/// </summary>
@@ -293,15 +272,6 @@ public partial class DataGrid : TemplatedControl,
get => GetValue(CellThemeProperty);
set => SetValue(CellThemeProperty, value);
}
/// <summary>
/// Gets or sets the theme applied to all column headers.
/// </summary>
public ControlTheme ColumnHeaderTheme
{
get => GetValue(ColumnHeaderThemeProperty);
set => SetValue(ColumnHeaderThemeProperty, value);
}
/// <summary>
/// Gets or sets the theme applied to all row groups.
@@ -1225,7 +1195,7 @@ public partial class DataGrid : TemplatedControl,
/// <summary>
/// Raises the CurrentCellChanged event.
/// </summary>
protected virtual void OnCurrentCellChanged(EventArgs e)
protected virtual void NotifyCurrentCellChanged(EventArgs e)
{
CurrentCellChanged?.Invoke(this, e);
}
@@ -1233,7 +1203,7 @@ public partial class DataGrid : TemplatedControl,
/// <summary>
/// Raises the LoadingRow event for row preparation.
/// </summary>
protected virtual void OnLoadingRow(DataGridRowEventArgs e)
protected virtual void NotifyLoadingRow(DataGridRowEventArgs e)
{
EventHandler<DataGridRowEventArgs>? handler = LoadingRow;
if (handler != null)
@@ -1276,7 +1246,7 @@ public partial class DataGrid : TemplatedControl,
/// <summary>
/// Raises the PreparingCellForEdit event.
/// </summary>
protected virtual void OnPreparingCellForEdit(DataGridPreparingCellForEditEventArgs e)
protected virtual void NotifyPreparingCellForEdit(DataGridPreparingCellForEditEventArgs e)
{
PreparingCellForEdit?.Invoke(this, e);
}
@@ -1284,7 +1254,7 @@ public partial class DataGrid : TemplatedControl,
/// <summary>
/// Raises the RowEditEnded event.
/// </summary>
protected virtual void OnRowEditEnded(DataGridRowEditEndedEventArgs e)
protected virtual void NotifyRowEditEnded(DataGridRowEditEndedEventArgs e)
{
RowEditEnded?.Invoke(this, e);
}
@@ -1292,7 +1262,7 @@ public partial class DataGrid : TemplatedControl,
/// <summary>
/// Raises the RowEditEnding event.
/// </summary>
protected virtual void OnRowEditEnding(DataGridRowEditEndingEventArgs e)
protected virtual void NotifyRowEditEnding(DataGridRowEditEndingEventArgs e)
{
RowEditEnding?.Invoke(this, e);
}
@@ -1301,7 +1271,7 @@ public partial class DataGrid : TemplatedControl,
/// Raises the SelectionChanged event and clears the _selectionChanged.
/// This event won't get raised again until after _selectionChanged is set back to true.
/// </summary>
protected virtual void OnSelectionChanged(SelectionChangedEventArgs e)
protected virtual void NotifySelectionChanged(SelectionChangedEventArgs e)
{
RaiseEvent(e);
}
@@ -1309,7 +1279,7 @@ public partial class DataGrid : TemplatedControl,
/// <summary>
/// Raises the UnloadingRow event for row recycling.
/// </summary>
protected virtual void OnUnloadingRow(DataGridRowEventArgs e)
protected virtual void NotifyUnloadingRow(DataGridRowEventArgs e)
{
EventHandler<DataGridRowEventArgs>? handler = UnloadingRow;
if (handler != null)