From 1d9593a2381f46c39ca275a7370e4e0a3c464d93 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Thu, 7 Mar 2019 22:18:00 +0800 Subject: [PATCH] Remove commented-out code on DataGrid. --- .../Collections/DataGridCollectionView.cs | 109 +- src/Avalonia.Controls.DataGrid/DataGrid.cs | 1088 +---------------- .../DataGridBoundColumn.cs | 161 +-- .../DataGridCell.cs | 117 +- .../DataGridColumn.cs | 180 +-- .../DataGridColumnCollection.cs | 1 - .../DataGridColumnHeader.cs | 220 +--- .../DataGridColumns.cs | 52 - .../DataGridDataConnection.cs | 12 - .../DataGridError.cs | 11 +- .../DataGridFillerColumn.cs | 1 - .../DataGridLength.cs | 1 - src/Avalonia.Controls.DataGrid/DataGridRow.cs | 373 +----- .../DataGridRowGroupHeader.cs | 88 +- .../DataGridRowHeader.cs | 283 +---- .../DataGridRows.cs | 45 +- .../DataGridSelectedItemsCollection.cs | 4 +- .../DataGridTemplateColumn.cs | 1 - .../DataGridTextColumn.cs | 24 - src/Avalonia.Controls.DataGrid/EventArgs.cs | 5 +- src/Avalonia.Controls.DataGrid/Extensions.cs | 2 +- .../Primitives/DataGridCellsPresenter.cs | 2 +- .../DataGridColumnHeadersPresenter.cs | 8 - .../Primitives/DataGridDetailsPresenter.cs | 5 - .../Primitives/DataGridRowsPresenter.cs | 9 - src/Avalonia.Controls.DataGrid/Range.cs | 2 +- .../Utils/CellEditBinding.cs | 2 +- .../Utils/ReflectionHelper.cs | 1 - src/Avalonia.Themes.Default/DataGrid.xaml | 1 - 29 files changed, 88 insertions(+), 2720 deletions(-) diff --git a/src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs b/src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs index b334595971..915dbe1e51 100644 --- a/src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs +++ b/src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs @@ -265,13 +265,6 @@ namespace Avalonia.Collections #region Private Delegates - // / - // / Delegate used to asynchronously trigger a page move. - // / - // / Requested page index - //TODO Not Needed? - //private delegate void RequestPageMoveDelegate(int pageIndex); - #endregion Private Delegates #region Events @@ -1003,13 +996,7 @@ namespace Avalonia.Collections } } - #endregion Public Properties - - ////------------------------------------------------------ - //// - //// Private Properties - //// - ////------------------------------------------------------ + #endregion Public Properties #region Private Properties @@ -1188,13 +1175,7 @@ namespace Avalonia.Collections get { return SortDescriptions.Count > 0 || Filter != null || _pageSize > 0 || GroupDescriptions.Count > 0; } } - #endregion Private Properties - - ////------------------------------------------------------ - //// - //// Indexers - //// - ////------------------------------------------------------ + #endregion Private Properties #region Indexers @@ -1208,13 +1189,7 @@ namespace Avalonia.Collections get { return GetItemAt(index); } } - #endregion Indexers - - ////------------------------------------------------------ - //// - //// Public Methods - //// - ////------------------------------------------------------ + #endregion Indexers #region Public Methods @@ -2520,12 +2495,6 @@ namespace Avalonia.Collections #endregion Public Methods - ////------------------------------------------------------ - //// - //// Static Methods - //// - ////------------------------------------------------------ - #region Static Methods /// @@ -2547,12 +2516,6 @@ namespace Avalonia.Collections #endregion Static Methods - ////------------------------------------------------------ - //// - //// Private Methods - //// - ////------------------------------------------------------ - #region Private Methods /// @@ -3425,13 +3388,6 @@ namespace Avalonia.Collections } } - // if we need to add the item into the current group - // that will be displayed - //if (needsGrouping) - //{ - // _group.AddToSubgroups(addedItem, false /*loading*/); - //} - int addedIndex = IndexOf(addedItem); // if the item is within the current page @@ -3457,7 +3413,7 @@ namespace Avalonia.Collections { // otherwise if the item was added into a previous page int internalIndex = InternalIndexOf(addedItem); - //int internalIndex = IsGrouping ? _group.LeafIndexOf(addedItem) : InternalIndexOf(addedItem); + if (internalIndex < ConvertToInternalIndex(0)) { // fire add notification for item pushed in @@ -4030,23 +3986,8 @@ namespace Avalonia.Collections foreach (DataGridSortDescription sort in SortDescriptions) { - sort.Initialize(itemType); - //string propertyPath = sort.PropertyName; - //Type propertyType = null; - - // find the propertyType from the first non-null instance - // in the list - //foreach (object item in list) - //{ - // if (item != null) - // { - // propertyType = item.GetType().GetNestedPropertyType(propertyPath); - // break; - // } - //} - - //IOrderedEnumerable orderedEnum = seq as IOrderedEnumerable; - + sort.Initialize(itemType); + if(seq is IOrderedEnumerable orderedEnum) { seq = sort.ThenBy(orderedEnum); @@ -4055,38 +3996,6 @@ namespace Avalonia.Collections { seq = sort.OrderBy(seq); } - - //switch (sort.Direction) - //{ - // case System.ComponentModel.ListSortDirection.Ascending: - // if (orderedEnum != null) - // { - // // thenby - // seq = orderedEnum.ThenBy(item => InvokePath(item, propertyPath, propertyType), comparer); - // } - // else - // { - // // orderby - // seq = seq.OrderBy(item => InvokePath(item, propertyPath, propertyType), comparer); - // } - - // break; - // case System.ComponentModel.ListSortDirection.Descending: - // if (orderedEnum != null) - // { - // // thenby - // seq = orderedEnum.ThenByDescending(item => InvokePath(item, propertyPath, propertyType), comparer); - // } - // else - // { - // // orderby - // seq = seq.OrderByDescending(item => InvokePath(item, propertyPath, propertyType), comparer); - // } - - // break; - // default: - // break; - //} } return seq.ToList(); @@ -4109,12 +4018,6 @@ namespace Avalonia.Collections #endregion Private Methods - ////------------------------------------------------------ - //// - //// Private Classes - //// - ////------------------------------------------------------ - #region Private Classes /// diff --git a/src/Avalonia.Controls.DataGrid/DataGrid.cs b/src/Avalonia.Controls.DataGrid/DataGrid.cs index 1f57041001..31c5476640 100644 --- a/src/Avalonia.Controls.DataGrid/DataGrid.cs +++ b/src/Avalonia.Controls.DataGrid/DataGrid.cs @@ -72,23 +72,6 @@ namespace Avalonia.Controls private const double DATAGRID_defaultMinColumnWidth = 20; private const double DATAGRID_defaultMaxColumnWidth = double.PositiveInfinity; - /* - // DataGrid Template Parts - private ValidationSummary _validationSummary; - - private List _indeiValidationResults; - private DataGridCellCoordinates _previousAutomationFocusCoordinates; - private List _propertyValidationResults; - private ObservableCollection