Browse Source

Remove regions + superflous empty newlines.

pull/2109/head
Jumar Macato 8 years ago
parent
commit
0ffad0001a
No known key found for this signature in database GPG Key ID: B19884DAC3A5BF3F
  1. 64
      src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs
  2. 12
      src/Avalonia.Controls.DataGrid/Collections/DataGridGroupDescription.cs
  3. 3
      src/Avalonia.Controls.DataGrid/Collections/DataGridSortDescription.cs
  4. 4
      src/Avalonia.Controls.DataGrid/Collections/IDataGridCollectionView.cs
  5. 1402
      src/Avalonia.Controls.DataGrid/DataGrid.cs
  6. 53
      src/Avalonia.Controls.DataGrid/DataGridBoundColumn.cs
  7. 2
      src/Avalonia.Controls.DataGrid/DataGridCell.cs
  8. 14
      src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs
  9. 24
      src/Avalonia.Controls.DataGrid/DataGridClipboard.cs
  10. 18
      src/Avalonia.Controls.DataGrid/DataGridColumn.cs
  11. 15
      src/Avalonia.Controls.DataGrid/DataGridColumnCollection.cs
  12. 35
      src/Avalonia.Controls.DataGrid/DataGridColumnHeader.cs
  13. 34
      src/Avalonia.Controls.DataGrid/DataGridColumns.cs
  14. 21
      src/Avalonia.Controls.DataGrid/DataGridDataConnection.cs
  15. 1
      src/Avalonia.Controls.DataGrid/DataGridDisplayData.cs
  16. 16
      src/Avalonia.Controls.DataGrid/DataGridLength.cs
  17. 78
      src/Avalonia.Controls.DataGrid/DataGridRow.cs
  18. 12
      src/Avalonia.Controls.DataGrid/DataGridRowGroupHeader.cs
  19. 33
      src/Avalonia.Controls.DataGrid/DataGridRowHeader.cs
  20. 24
      src/Avalonia.Controls.DataGrid/DataGridRows.cs
  21. 22
      src/Avalonia.Controls.DataGrid/DataGridTextColumn.cs
  22. 12
      src/Avalonia.Controls.DataGrid/EventArgs.cs
  23. 2
      src/Avalonia.Controls.DataGrid/Primitives/DataGridCellsPresenter.cs
  24. 3
      src/Avalonia.Controls.DataGrid/Primitives/DataGridDetailsPresenter.cs
  25. 2
      src/Avalonia.Controls.DataGrid/Primitives/DataGridRowsPresenter.cs
  26. 1
      src/Avalonia.Controls.DataGrid/Utils/ReflectionHelper.cs
  27. 3
      src/Avalonia.Controls.DataGrid/Utils/ValidationUtil.cs

64
src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs

@ -51,24 +51,18 @@ namespace Avalonia.Collections
/// <returns>A custom view for specialized sorting, filtering, grouping, and currency.</returns>
IDataGridCollectionView CreateView();
}
/// <summary>
/// PagedCollectionView view over an IEnumerable.
/// </summary>
public sealed class CollectionViewBase : IDataGridCollectionView, IDataGridEditableCollectionView, INotifyPropertyChanged //IPagedCollectionView,
{
#region Static Fields and Constants
/// <summary>
/// Since there's nothing in the un-cancelable event args that is mutable,
/// just create one instance to be used universally.
/// </summary>
private static readonly DataGridCurrentChangingEventArgs uncancelableCurrentChangingEventArgs = new DataGridCurrentChangingEventArgs(false);
#endregion Static Fields and Constants
#region Private Fields
/// <summary>
/// Value that we cache for the PageIndex if we are in a DeferRefresh,
/// and the user has attempted to move to a different page.
@ -201,10 +195,6 @@ namespace Avalonia.Collections
/// </summary>
private IEnumerator _trackingEnumerator;
#endregion Private Fields
#region Constructors
/// <summary>
/// Helper constructor that sets default values for isDataSorted and isDataInGroupOrder.
/// </summary>
@ -261,14 +251,6 @@ namespace Avalonia.Collections
}
}
#endregion Constructors
#region Private Delegates
#endregion Private Delegates
#region Events
/// <summary>
/// Raise this event when the (filtered) view changes
/// </summary>
@ -319,10 +301,6 @@ namespace Avalonia.Collections
remove { PropertyChanged -= value; }
}
#endregion Events
#region Enumerators
/// <summary>
/// Enum for CollectionViewFlags
/// </summary>
@ -382,8 +360,6 @@ namespace Avalonia.Collections
IsUpdatePageSizeDeferred = 0x200
}
#endregion Enumerators
private Type _itemType;
private Type ItemType
{
@ -396,8 +372,6 @@ namespace Avalonia.Collections
}
}
#region Public Properties
/// <summary>
/// Gets a value indicating whether the view supports AddNew.
/// </summary>
@ -804,7 +778,6 @@ namespace Avalonia.Collections
{
get { return CheckFlag(CollectionViewFlags.NeedsRefresh); }
}
/// <summary>
/// Gets the current page we are on. (zero based)
@ -996,10 +969,6 @@ namespace Avalonia.Collections
}
}
#endregion Public Properties
#region Private Properties
/// <summary>
/// Gets a value indicating whether we have a valid ItemConstructor of the correct type
/// </summary>
@ -1175,10 +1144,6 @@ namespace Avalonia.Collections
get { return SortDescriptions.Count > 0 || Filter != null || _pageSize > 0 || GroupDescriptions.Count > 0; }
}
#endregion Private Properties
#region Indexers
/// <summary>
/// Return the item at the specified index
/// </summary>
@ -1189,10 +1154,6 @@ namespace Avalonia.Collections
get { return GetItemAt(index); }
}
#endregion Indexers
#region Public Methods
/// <summary>
/// Add a new item to the underlying collection. Returns the new item.
/// After calling AddNew and changing the new item as desired, either
@ -2493,10 +2454,6 @@ namespace Avalonia.Collections
}
}
#endregion Public Methods
#region Static Methods
/// <summary>
/// Helper for SortList to handle nested properties (e.g. Address.Street)
/// </summary>
@ -2514,10 +2471,6 @@ namespace Avalonia.Collections
return propertyValue;
}
#endregion Static Methods
#region Private Methods
/// <summary>
/// Fix up CurrentPosition and CurrentItem after a collection change
/// </summary>
@ -3983,7 +3936,6 @@ namespace Avalonia.Collections
IComparer<object> comparer = new CultureSensitiveComparer(Culture);
var itemType = ItemType;
foreach (DataGridSortDescription sort in SortDescriptions)
{
sort.Initialize(itemType);
@ -4016,10 +3968,6 @@ namespace Avalonia.Collections
}
}
#endregion Private Methods
#region Private Classes
/// <summary>
/// Creates a comparer class that takes in a CultureInfo as a parameter,
/// which it will use when comparing strings.
@ -4042,8 +3990,6 @@ namespace Avalonia.Collections
_culture = culture ?? CultureInfo.InvariantCulture;
}
#region IComparer<object> Members
/// <summary>
/// Compares two objects and returns a value indicating whether one is less than, equal to or greater than the other.
/// </summary>
@ -4078,8 +4024,6 @@ namespace Avalonia.Collections
return Comparer<object>.Default.Compare(x, y);
}
}
#endregion
}
/// <summary>
@ -4367,8 +4311,6 @@ namespace Avalonia.Collections
return min;
}
}
#endregion Private Classes
}
}
}
}

12
src/Avalonia.Controls.DataGrid/Collections/DataGridGroupDescription.cs

@ -221,7 +221,6 @@ namespace Avalonia.Collections
_parentGroup?.OnGroupByChanged();
}
/// <summary>
/// Gets or sets the most recent index where activity took place
/// </summary>
@ -254,7 +253,7 @@ namespace Avalonia.Collections
}
// we shouldn't get here, but just in case...
return AvaloniaProperty.UnsetValue;
}
else
@ -536,7 +535,6 @@ namespace Avalonia.Collections
}
}
/// <summary>
/// Update the item count of the CollectionViewGroup
/// </summary>
@ -569,7 +567,6 @@ namespace Avalonia.Collections
}
}
/// <summary>
/// Enumerator for the leaves in the CollectionViewGroupInternal class.
/// </summary>
@ -602,8 +599,6 @@ namespace Avalonia.Collections
_subEnum = null;
}
#region Implement IEnumerator
/// <summary>
/// Reset implementation for IEnumerator
/// </summary>
@ -675,7 +670,6 @@ namespace Avalonia.Collections
}
}
#endregion Implement IEnumerator
}
// / <summary>
@ -925,7 +919,6 @@ namespace Avalonia.Collections
set { _isDataInGroupOrder = value; }
}
/// <summary>
/// Finds the index of the specified item
/// </summary>
@ -1087,7 +1080,6 @@ namespace Avalonia.Collections
subgroup = new DataGridCollectionViewGroupInternal(key, group);
InitializeGroup(subgroup, level + 1, item);
if (loading)
{
group.Add(subgroup);
@ -1104,7 +1096,6 @@ namespace Avalonia.Collections
AddToSubgroups(item, subgroup, level + 1, loading);
}
/// <summary>
/// Add an item to the desired subgroup(s) of the given group
/// </summary>
@ -1345,7 +1336,6 @@ namespace Avalonia.Collections
}
}
/// <summary>
/// TopLevelGroupDescription class
/// </summary>

3
src/Avalonia.Controls.DataGrid/Collections/DataGridSortDescription.cs

@ -69,8 +69,6 @@ namespace Avalonia.Collections
_culture = culture ?? CultureInfo.InvariantCulture;
}
#region IComparer<object> Members
/// <summary>
/// Compares two objects and returns a value indicating whether one is less than, equal to or greater than the other.
/// </summary>
@ -106,7 +104,6 @@ namespace Avalonia.Collections
}
}
#endregion
}
private class DataGridPathSortDescription : DataGridSortDescription

4
src/Avalonia.Controls.DataGrid/Collections/IDataGridCollectionView.cs

@ -104,7 +104,7 @@ namespace Avalonia.Collections
/// <summary>Gets a collection of <see cref="T:System.ComponentModel.GroupDescription" /> objects that describe how the items in the collection are grouped in the view. </summary>
/// <returns>A collection of objects that describe how the items in the collection are grouped in the view. </returns>
//ObservableCollection<GroupDescription> GroupDescriptions { get; }
bool IsGrouping { get; }
int GroupingDepth { get; }
string GetGroupingPropertyNameAtDepth(int level);
@ -112,7 +112,7 @@ namespace Avalonia.Collections
/// <summary>Gets the top-level groups.</summary>
/// <returns>A read-only collection of the top-level groups or null if there are no groups.</returns>
IAvaloniaReadOnlyList<object> Groups { get; }
/// <summary>Gets a value that indicates whether the view is empty.</summary>
/// <returns>true if the view is empty; otherwise, false.</returns>
bool IsEmpty { get; }

1402
src/Avalonia.Controls.DataGrid/DataGrid.cs

File diff suppressed because it is too large

53
src/Avalonia.Controls.DataGrid/DataGridBoundColumn.cs

@ -1,7 +1,7 @@
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
// All other rights reserved.
using Avalonia.Data;
using Avalonia.Utilities;
@ -10,7 +10,7 @@ using System.Reactive.Disposables;
using System.Reactive.Subjects;
using Avalonia.Reactive;
using System.Diagnostics;
using Avalonia.Controls.Utils;
using Avalonia.Controls.Utils;
namespace Avalonia.Controls
{
@ -20,8 +20,8 @@ namespace Avalonia.Controls
/// </summary>
public abstract class DataGridBoundColumn : DataGridColumn
{
private IBinding _binding;
private IBinding _binding;
/// <summary>
/// Gets or sets the binding that associates the column with a property in the data source.
/// </summary>
@ -40,10 +40,9 @@ namespace Avalonia.Controls
{
// Edited value couldn't be committed, so we force a CancelEdit
OwningGrid.CancelEdit(DataGridEditingUnit.Row, raiseEvents: false);
}
_binding = value;
}
_binding = value;
if (_binding != null)
{
@ -53,25 +52,25 @@ namespace Avalonia.Controls
if (!String.IsNullOrEmpty(binding.Path))
{
binding.Mode = BindingMode.TwoWay;
}
}
if (binding.Converter == null)
{
binding.Converter = DataGridValueConverter.Instance;
}
}
}
// Apply the new Binding to existing rows in the DataGrid
if (OwningGrid != null)
{
OwningGrid.OnColumnBindingChanged(this);
}
}
}
RemoveEditingElement();
}
}
}
}
/// <summary>
/// The binding that will be used to get or set cell content for the clipboard.
@ -87,47 +86,47 @@ namespace Avalonia.Controls
{
base.ClipboardContentBinding = value;
}
}
}
//TODO Rename
//TODO Validation
protected sealed override IControl GenerateEditingElement(DataGridCell cell, object dataItem, out ICellEditBinding editBinding)
{
IControl element = GenerateEditingElementDirect(cell, dataItem);
editBinding = null;
editBinding = null;
if (Binding != null)
{
editBinding = BindEditingElement(element, BindingTarget, Binding);
}
}
return element;
}
}
private static ICellEditBinding BindEditingElement(IAvaloniaObject target, AvaloniaProperty property, IBinding binding)
{
var result = binding.Initiate(target, property, enableDataValidation: true);
var result = binding.Initiate(target, property, enableDataValidation: true);
if (result != null)
{
if(result.Subject != null)
{
var bindingHelper = new CellEditBinding(result.Subject);
var instanceBinding = new InstancedBinding(bindingHelper.InternalSubject, result.Mode, result.Priority);
var instanceBinding = new InstancedBinding(bindingHelper.InternalSubject, result.Mode, result.Priority);
BindingOperations.Apply(target, property, instanceBinding, null);
return bindingHelper;
}
}
BindingOperations.Apply(target, property, result, null);
}
}
return null;
}
}
protected abstract IControl GenerateEditingElementDirect(DataGridCell cell, object dataItem);
protected abstract IControl GenerateEditingElementDirect(DataGridCell cell, object dataItem);
internal AvaloniaProperty BindingTarget { get; set; }
internal AvaloniaProperty BindingTarget { get; set; }
internal void SetHeaderFromBinding()
{
@ -142,13 +141,5 @@ namespace Avalonia.Controls
}
}
}
}
#region Binding
#endregion
#region Styles
#endregion
}
}

2
src/Avalonia.Controls.DataGrid/DataGridCell.cs

@ -182,7 +182,7 @@ namespace Avalonia.Controls
internal void UpdatePseudoClasses()
{
}
// Makes sure the right gridline has the proper stroke and visibility. If lastVisibleColumn is specified, the

14
src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs

@ -17,15 +17,12 @@ namespace Avalonia.Controls
/// </summary>
public class DataGridCheckBoxColumn : DataGridBoundColumn
{
#region Data
private bool _beganEditWithKeyboard;
private bool _isThreeState;
private CheckBox _currentCheckBox;
private DataGrid _owningGrid;
#endregion Data
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Windows.Controls.DataGridCheckBoxColumn" /> class.
/// </summary>
@ -34,8 +31,6 @@ namespace Avalonia.Controls
BindingTarget = CheckBox.IsCheckedProperty;
}
#region Public Properties
/// <summary>
/// Gets or sets a value that indicates whether the hosted <see cref="T:System.Windows.Controls.CheckBox" /> controls allow three states or two.
/// </summary>
@ -58,10 +53,6 @@ namespace Avalonia.Controls
}
}
#endregion Public Properties
#region Protected Methods
/// <summary>
/// Causes the column cell being edited to revert to the specified value.
/// </summary>
@ -222,10 +213,6 @@ namespace Avalonia.Controls
}
}
#endregion Protected Methods
#region Private Methods
private void Columns_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Remove && e.OldItems.Contains(this) && _owningGrid != null)
@ -325,6 +312,5 @@ namespace Avalonia.Controls
}
}
#endregion Private Methods
}
}

24
src/Avalonia.Controls.DataGrid/DataGridClipboard.cs

@ -36,16 +36,11 @@ namespace Avalonia.Controls
/// </summary>
public struct DataGridClipboardCellContent
{
#region Data
private DataGridColumn _column;
private object _content;
private object _item;
#endregion Data
#region Constructors
/// <summary>
/// Creates a new DataGridClipboardCellValue structure containing information about a DataGrid cell.
/// </summary>
@ -59,10 +54,6 @@ namespace Avalonia.Controls
this._content = content;
}
#endregion Constructors
#region Public Properties
/// <summary>
/// DataGridColumn containing the cell.
/// </summary>
@ -96,10 +87,6 @@ namespace Avalonia.Controls
}
}
#endregion Public Properties
#region Public Methods
/// <summary>
/// Field-by-field comparison to avoid reflection-based ValueType.Equals.
/// </summary>
@ -152,7 +139,6 @@ namespace Avalonia.Controls
return true;
}
#endregion Public Methods
}
/// <summary>
@ -160,16 +146,11 @@ namespace Avalonia.Controls
/// </summary>
public class DataGridRowClipboardEventArgs : EventArgs
{
#region Data
private List<DataGridClipboardCellContent> _clipboardRowContent;
private bool _isColumnHeadersRow;
private object _item;
#endregion Data
#region Constructor
/// <summary>
/// Creates a DataGridRowClipboardEventArgs object and initializes the properties.
/// </summary>
@ -181,10 +162,6 @@ namespace Avalonia.Controls
_item = item;
}
#endregion Constructor
#region Public Properties
/// <summary>
/// This list should be used to modify, add ot remove a cell content before it gets stored into the clipboard.
/// </summary>
@ -222,7 +199,6 @@ namespace Avalonia.Controls
}
}
#endregion Public Properties
}
}

18
src/Avalonia.Controls.DataGrid/DataGridColumn.cs

@ -198,7 +198,7 @@ namespace Avalonia.Controls
}
}
}
/// <summary>
/// Actual visible width after Width, MinWidth, and MaxWidth setting at the Column level and DataGrid level
/// have been taken into account
@ -387,7 +387,6 @@ namespace Avalonia.Controls
}
}
public object Header
{
get
@ -470,7 +469,7 @@ namespace Avalonia.Controls
}
}
}
public double MinWidth
{
get
@ -506,7 +505,7 @@ namespace Avalonia.Controls
}
}
}
public DataGridLength Width
{
get
@ -987,7 +986,7 @@ namespace Avalonia.Controls
{
_editingElement = GenerateEditingElement(cell, dataItem, out _editBinding);
}
return _editingElement;
}
@ -1026,7 +1025,7 @@ namespace Avalonia.Controls
return null;
}
internal string GetSortPropertyName()
{
string result = SortMemberPath;
@ -1047,12 +1046,5 @@ namespace Avalonia.Controls
}
}
#region Styles
#endregion
#region Binding
#endregion
}

15
src/Avalonia.Controls.DataGrid/DataGridColumnCollection.cs

@ -23,8 +23,6 @@ namespace Avalonia.Controls
DisplayIndexMap = new List<int>();
}
#region Properties
internal int AutogeneratedColumnCount
{
get;
@ -156,10 +154,6 @@ namespace Avalonia.Controls
private set;
}
#endregion Properties
#region Protected Methods
protected override void ClearItems()
{
try
@ -255,10 +249,6 @@ namespace Avalonia.Controls
throw new NotSupportedException();
}
#endregion Protected Methods
#region Internal Methods
internal bool DisplayInOrder(int columnIndex1, int columnIndex2)
{
int displayIndex1 = ItemsInternal[columnIndex1].DisplayIndexWithFiller;
@ -548,10 +538,6 @@ namespace Avalonia.Controls
return GetDisplayedColumns(filter);
}
#endregion Internal Methods
#region Private Methods
private void RemoveItemPrivate(int columnIndex, bool isSpacer)
{
try
@ -596,6 +582,5 @@ namespace Avalonia.Controls
}
}
#endregion Private Methods
}
}

35
src/Avalonia.Controls.DataGrid/DataGridColumnHeader.cs

@ -32,7 +32,7 @@ namespace Avalonia.Controls
private const int DATAGRIDCOLUMNHEADER_resizeRegionWidth = 5;
private const double DATAGRIDCOLUMNHEADER_separatorThickness = 1;
private bool _areHandlersSuspended;
private static DragMode _dragMode;
private static Point? _lastMousePositionHeaders;
@ -82,10 +82,6 @@ namespace Avalonia.Controls
PointerEnter += DataGridColumnHeader_PointerEnter;
PointerLeave += DataGridColumnHeader_PointerLeave;
}
#region Protected Methods
#endregion Protected Methods
private void OnAreSeparatorsVisibleChanged(AvaloniaPropertyChangedEventArgs e)
{
@ -103,15 +99,13 @@ namespace Avalonia.Controls
}
}
#region Internal Properties
internal DataGridColumn OwningColumn
{
get;
set;
}
internal DataGrid OwningGrid => OwningColumn?.OwningGrid;
internal int ColumnIndex
{
get
@ -130,10 +124,6 @@ namespace Avalonia.Controls
private set;
}
#endregion Internal Properties
#region Private Properties
private bool IsMouseOver
{
get;
@ -146,8 +136,6 @@ namespace Avalonia.Controls
set;
}
#endregion Private Properties
private void SetValueNoCallback<T>(AvaloniaProperty<T> property, T value, BindingPriority priority = BindingPriority.LocalValue)
{
_areHandlersSuspended = true;
@ -161,8 +149,6 @@ namespace Avalonia.Controls
}
}
#region Internal Methods
//TODO Implement
internal void ApplyState()
{
@ -292,9 +278,6 @@ namespace Avalonia.Controls
}
}
}
#endregion Internal Methods
#region Private Methods
private bool CanReorderColumn(DataGridColumn column)
{
@ -335,10 +318,6 @@ namespace Avalonia.Controls
return false;
}
#endregion Private Methods
#region DragDrop
//TODO DragDrop
internal void OnMouseLeftButtonDown(ref bool handled, PointerEventArgs args, Point mousePosition)
@ -750,7 +729,7 @@ namespace Avalonia.Controls
isFrozen: OwningColumn.IsFrozen,
isReadOnly: null);
targetPosition = targetColumn.HeaderCell.Translate(OwningGrid.ColumnHeaders, targetPosition);
targetPosition = targetPosition.WithX(targetPosition.X + targetColumn.ActualWidth);
}
else
@ -805,7 +784,7 @@ namespace Avalonia.Controls
{
previousColumn = OwningGrid.ColumnsInternal.GetPreviousVisibleNonFillerColumn(currentColumn);
}
if ((distanceFromRight <= DATAGRIDCOLUMNHEADER_resizeRegionWidth && currentColumn != null && CanResizeColumn(currentColumn)) ||
(distanceFromLeft <= DATAGRIDCOLUMNHEADER_resizeRegionWidth && previousColumn != null && CanResizeColumn(previousColumn)))
{
@ -822,12 +801,6 @@ namespace Avalonia.Controls
}
}
#endregion
}
#region Style
#endregion
}

34
src/Avalonia.Controls.DataGrid/DataGridColumns.cs

@ -16,7 +16,6 @@ namespace Avalonia.Controls
{
public partial class DataGrid
{
#region Protected Methods
protected virtual void OnColumnDisplayIndexChanged(DataGridColumnEventArgs e)
{
@ -34,10 +33,6 @@ namespace Avalonia.Controls
ColumnReordering?.Invoke(this, e);
}
#endregion Protected Methods
#region Internal Methods
/// <summary>
/// Adjusts the widths of all columns with DisplayIndex >= displayIndex such that the total
/// width is adjusted by the given amount, if possible. If the total desired adjustment amount
@ -345,7 +340,7 @@ namespace Avalonia.Controls
}
}
}
/// <summary>
/// Adjusts the specified column's width according to its new maximum value.
/// </summary>
@ -770,10 +765,6 @@ namespace Avalonia.Controls
}
}
#endregion Internal Methods
#region Private Methods
/// <summary>
/// Adjusts the widths of all star columns with DisplayIndex >= displayIndex such that the total
/// width is adjusted by the given amount, if possible. If the total desired adjustment amount
@ -901,7 +892,7 @@ namespace Avalonia.Controls
return remainingAdjustment;
}
private bool ComputeDisplayedColumns()
{
bool invalidate = false;
@ -1137,7 +1128,7 @@ namespace Avalonia.Controls
column.DisplayIndexHasChanged = true; // OnColumnDisplayIndexChanged needs to be raised later on
}
}
// Now raise all the OnColumnDisplayIndexChanged events
FlushDisplayIndexChanged(true /*raiseEvent*/);
}
@ -1180,7 +1171,7 @@ namespace Avalonia.Controls
}
}
ColumnsInternal.DisplayIndexMap.Insert(insertedColumn.DisplayIndexWithFiller, insertedColumn.Index);
// Now raise all the OnColumnDisplayIndexChanged events
FlushDisplayIndexChanged(true /*raiseEvent*/);
}
@ -1317,7 +1308,7 @@ namespace Avalonia.Controls
}
}
}
private bool GetColumnEffectiveReadOnlyState(DataGridColumn dataGridColumn)
{
Debug.Assert(dataGridColumn != null);
@ -1346,7 +1337,7 @@ namespace Avalonia.Controls
}
return x;
}
private double GetNegHorizontalOffsetFromHorizontalOffset(double horizontalOffset)
{
foreach (DataGridColumn column in ColumnsInternal.GetVisibleScrollingColumns())
@ -1622,10 +1613,6 @@ namespace Avalonia.Controls
ComputeDisplayedColumns();
}
#endregion Private Methods
#region AutoGenerate
private static DataGridBoundColumn GetDataGridColumnFromType(Type type)
{
Debug.Assert(type != null);
@ -1772,15 +1759,6 @@ namespace Avalonia.Controls
}
}
#endregion
}
#region DragDrop
#endregion
#region Styles
#endregion
}

21
src/Avalonia.Controls.DataGrid/DataGridDataConnection.cs

@ -20,8 +20,7 @@ namespace Avalonia.Controls
{
internal class DataGridDataConnection
{
#region Data
private int _backupSlotForCurrentChanged;
private int _columnForCurrentChanged;
private PropertyInfo[] _dataProperties;
@ -33,15 +32,11 @@ namespace Avalonia.Controls
private bool _scrollForCurrentChanged;
private DataGridSelectionAction _selectionActionForCurrentChanged;
#endregion Data
public DataGridDataConnection(DataGrid owner)
{
_owner = owner;
}
#region Properties
public bool AllowEdit
{
get
@ -215,10 +210,6 @@ namespace Avalonia.Controls
}
}
#endregion Properties
#region Public Methods
/// <summary>
/// Puts the entity into editing mode if possible
/// </summary>
@ -444,10 +435,6 @@ namespace Avalonia.Controls
return -1;
}
#endregion Public methods
#region Internal Methods
internal void ClearDataProperties()
{
_dataProperties = null;
@ -552,10 +539,6 @@ namespace Avalonia.Controls
EventsWired = true;
}
#endregion Internal Methods
#region Private methods
private void CollectionView_CurrentChanged(object sender, EventArgs e)
{
if (_expectingCurrentChanged)
@ -694,7 +677,6 @@ namespace Avalonia.Controls
}
}
private void UpdateDataProperties()
{
Type dataType = DataType;
@ -710,6 +692,5 @@ namespace Avalonia.Controls
}
}
#endregion Private Methods
}
}

1
src/Avalonia.Controls.DataGrid/DataGridDisplayData.cs

@ -251,7 +251,6 @@ namespace Avalonia.Controls
return GetScrollingElements(element => element is DataGridRow);
}
internal DataGridRow GetUsedRow()
{
if (_recyclableRows.Count > 0)

16
src/Avalonia.Controls.DataGrid/DataGridLength.cs

@ -26,7 +26,6 @@ namespace Avalonia.Controls
[TypeConverter(typeof(DataGridLengthConverter))]
public struct DataGridLength : IEquatable<DataGridLength>
{
#region Data
private double _desiredValue; // desired value storage
private double _displayValue; // display value storage
@ -41,10 +40,6 @@ namespace Avalonia.Controls
// WPF uses 1.0 as the default value as well
internal const double DATAGRIDLENGTH_DefaultValue = 1.0;
#endregion Data
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="T:Avalonia.Controls.DataGridLength" /> class.
/// </summary>
@ -136,10 +131,6 @@ namespace Avalonia.Controls
_unitType = type;
}
#endregion Constructors
#region Properties
/// <summary>
/// Gets a <see cref="T:Avalonia.Controls.DataGridLength" /> structure that represents the standard automatic sizing mode.
/// </summary>
@ -287,10 +278,6 @@ namespace Avalonia.Controls
}
}
#endregion Properties
#region Methods
/// <summary>
/// Overloaded operator, compares 2 DataGridLength's.
/// </summary>
@ -357,7 +344,6 @@ namespace Avalonia.Controls
return ((int)_unitValue + (int)_unitType) + (int)_desiredValue + (int)_displayValue;
}
#endregion Methods
}
/// <summary>
/// DataGridLengthConverter - Converter class for converting instances of other types to and from DataGridLength instances.
@ -368,7 +354,7 @@ namespace Avalonia.Controls
private static string _starSuffix = "*";
private static string[] _valueInvariantUnitStrings = { "auto", "sizetocells", "sizetoheader" };
private static DataGridLength[] _valueInvariantDataGridLengths = { DataGridLength.Auto, DataGridLength.SizeToCells, DataGridLength.SizeToHeader };
/// <summary>
/// Checks whether or not this class can convert from a given type.
/// </summary>

78
src/Avalonia.Controls.DataGrid/DataGridRow.cs

@ -22,7 +22,6 @@ namespace Avalonia.Controls
/// </summary>
public class DataGridRow : TemplatedControl
{
#region Constants
private const byte DATAGRIDROW_defaultMinHeight = 0;
internal const int DATAGRIDROW_maximumHeight = 65536;
@ -34,11 +33,6 @@ namespace Avalonia.Controls
internal const string DATAGRIDROW_elementRoot = "PART_Root";
internal const string DATAGRIDROW_elementRowHeader = "PART_RowHeader";
#endregion
#region Fields
private DataGridCellsPresenter _cellsElement;
private DataGridCell _fillerCell;
private DataGridRowHeader _headerElement;
@ -67,10 +61,6 @@ namespace Avalonia.Controls
private bool? _appliedDetailsVisibility;
#endregion
#region Avalonia Properties
/// <summary>
/// Identifies the Header dependency property.
/// </summary>
@ -85,7 +75,7 @@ namespace Avalonia.Controls
get { return GetValue(HeaderProperty); }
set { SetValue(HeaderProperty, value); }
}
public static readonly DirectProperty<DataGridRow, bool> IsValidProperty =
AvaloniaProperty.RegisterDirect<DataGridRow, bool>(
nameof(IsValid),
@ -123,8 +113,6 @@ namespace Avalonia.Controls
get { return GetValue(AreDetailsVisibleProperty); }
set { SetValue(AreDetailsVisibleProperty, value); }
}
#endregion
static DataGridRow()
{
@ -133,7 +121,7 @@ namespace Avalonia.Controls
AreDetailsVisibleProperty.Changed.AddClassHandler<DataGridRow>(x => x.OnAreDetailsVisibleChanged);
PointerPressedEvent.AddClassHandler<DataGridRow>(x => x.DataGridRow_PointerPressed, handledEventsToo: true);
}
/// <summary>
/// Initializes a new instance of the <see cref="T:Avalonia.Controls.DataGridRow" /> class.
/// </summary>
@ -178,7 +166,7 @@ namespace Avalonia.Controls
{
var oldValue = (IDataTemplate)e.OldValue;
var newValue = (IDataTemplate)e.NewValue;
if (!_areHandlersSuspended && OwningGrid != null)
{
IDataTemplate actualDetailsTemplate(IDataTemplate template) => (template ?? OwningGrid.RowDetailsTemplate);
@ -211,14 +199,12 @@ namespace Avalonia.Controls
}
}
#region Properties
internal DataGrid OwningGrid
{
get;
set;
}
/// <summary>
/// Index of the row
/// </summary>
@ -227,7 +213,7 @@ namespace Avalonia.Controls
get;
set;
}
internal double ActualBottomGridLineHeight
{
get
@ -303,7 +289,7 @@ namespace Avalonia.Controls
get;
private set;
}
internal bool IsMouseOver
{
get
@ -331,7 +317,7 @@ namespace Avalonia.Controls
get;
private set;
}
internal bool IsRecyclable
{
get
@ -343,7 +329,7 @@ namespace Avalonia.Controls
return true;
}
}
internal bool IsSelected
{
get
@ -357,7 +343,7 @@ namespace Avalonia.Controls
return OwningGrid.GetRowSelection(Slot);
}
}
internal int? MouseOverColumnIndex
{
get
@ -426,12 +412,6 @@ namespace Avalonia.Controls
}
}
#endregion
#region Methods
#region Public
/// <summary>
/// Returns the index of the current row.
/// </summary>
@ -462,10 +442,6 @@ namespace Avalonia.Controls
return row;
}
#endregion
#region Protected
/// <summary>
/// Arranges the content of the <see cref="T:Avalonia.Controls.DataGridRow" />.
/// </summary>
@ -638,10 +614,6 @@ namespace Avalonia.Controls
base.OnPointerLeave(e);
}
#endregion
#region Internal
internal void ApplyCellsState()
{
foreach (DataGridCell dataGridCell in Cells)
@ -668,7 +640,7 @@ namespace Avalonia.Controls
ApplyHeaderStatus();
}
}
//TODO Animation
internal void DetachFromDataGrid(bool recycle)
{
@ -802,10 +774,6 @@ namespace Avalonia.Controls
_bottomGridLine = null;
}
#endregion
#region Private
private void DataGridCellCollection_CellAdded(object sender, DataGridCellEventArgs e)
{
_cellsElement?.Children.Add(e.Cell);
@ -815,7 +783,7 @@ namespace Avalonia.Controls
{
_cellsElement?.Children.Remove(e.Cell);
}
private void DataGridRow_PointerPressed(PointerPressedEventArgs e)
{
if(e.MouseButton != MouseButton.Left)
@ -837,13 +805,6 @@ namespace Avalonia.Controls
}
}
#endregion
#endregion
#region Row Details
private void OnRowDetailsChanged()
{
OwningGrid?.OnRowDetailsChanged();
@ -875,7 +836,7 @@ namespace Avalonia.Controls
return OwningGrid.GetRowDetailsVisibility(Index);
}
}
private void UnloadDetailsTemplate(bool recycle)
{
if (_detailsElement != null)
@ -1027,7 +988,7 @@ namespace Avalonia.Controls
{
_detailsElement.ContentHeight = 0;
}
OnRowDetailsChanged();
if (raiseNotification)
@ -1087,20 +1048,9 @@ namespace Avalonia.Controls
}
}
}
#endregion
}
#region Constants
#endregion Constants
#region Data
#endregion Data
#region HeaderStyle
}
//TODO Styles
#endregion HeaderStyle
}

12
src/Avalonia.Controls.DataGrid/DataGridRowGroupHeader.cs

@ -121,8 +121,6 @@ namespace Avalonia.Controls
AddHandler(InputElement.PointerPressedEvent, (s, e) => DataGridRowGroupHeader_PointerPressed(e), handledEventsToo: true);
}
#region Properties
internal DataGridRowHeader HeaderCell
{
get
@ -182,10 +180,6 @@ namespace Avalonia.Controls
}
}
#endregion Properties
#region Methods
private IDisposable _expanderButtonSubscription;
protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
@ -222,7 +216,7 @@ namespace Avalonia.Controls
base.OnTemplateApplied(e);
}
internal void ApplyHeaderStatus()
{
if (_headerElement != null && OwningGrid.AreRowHeadersVisible)
@ -391,7 +385,7 @@ namespace Avalonia.Controls
base.OnPointerLeave(e);
}
private void SetIsCheckedNoCallBack(bool value)
{
if (_expanderButton != null && _expanderButton.IsChecked != value)
@ -447,11 +441,9 @@ namespace Avalonia.Controls
else
formatString = "({0} Items)";
_itemCountElement.Text = String.Format(formatString, RowGroupInfo.CollectionViewGroup.ItemCount);
}
}
#endregion Methods
}
}

33
src/Avalonia.Controls.DataGrid/DataGridRowHeader.cs

@ -17,14 +17,8 @@ namespace Avalonia.Controls.Primitives
private const string DATAGRIDROWHEADER_elementRootName = "Root";
private const double DATAGRIDROWHEADER_separatorThickness = 1;
#region Data
private Control _rootElement;
#endregion Data
#region Dependency Properties
public static readonly StyledProperty<IBrush> SeparatorBrushProperty =
AvaloniaProperty.Register<DataGridRowHeader, IBrush>(nameof(SeparatorBrush));
@ -47,8 +41,6 @@ namespace Avalonia.Controls.Primitives
set { SetValue(AreSeparatorsVisibleProperty, value); }
}
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="T:Avalonia.Controls.Primitives.DataGridRowHeader" /> class.
/// </summary>
@ -57,8 +49,6 @@ namespace Avalonia.Controls.Primitives
AddHandler(PointerPressedEvent, DataGridRowHeader_PointerPressed, handledEventsToo: true);
}
#region Properties
internal Control Owner
{
get;
@ -101,10 +91,6 @@ namespace Avalonia.Controls.Primitives
}
}
#endregion
#region Protected Methods
/// <summary>
/// Builds the visual tree for the row header when a new template is applied.
/// </summary>
@ -147,23 +133,15 @@ namespace Avalonia.Controls.Primitives
return measuredSize;
}
#endregion Protected Methods
#region Internal Methods
//TODO Implement
internal void ApplyOwnerStatus()
{
if (_rootElement != null && Owner != null && Owner.IsVisible)
{
}
}
#endregion Internal Methods
#region Private Methods
protected override void OnPointerEnter(PointerEventArgs e)
{
if (OwningRow != null)
@ -208,16 +186,7 @@ namespace Avalonia.Controls.Primitives
}
}
#endregion Private Methods
}
#region Styles
#endregion
#region Constants
#endregion Constants
}

24
src/Avalonia.Controls.DataGrid/DataGridRows.cs

@ -18,7 +18,6 @@ namespace Avalonia.Controls
{
public partial class DataGrid
{
#region Internal Properties
internal bool AreRowBottomGridLinesRequired
{
@ -59,10 +58,6 @@ namespace Avalonia.Controls
}
}
#endregion Internal Properties
#region Private Properties
// Cumulated height of all known rows, including the gridlines and details section.
// This property returns an approximation of the actual total row heights and also
// updates the RowHeightEstimate
@ -128,10 +123,6 @@ namespace Avalonia.Controls
}
}
#endregion Private Properties
#region Internal Methods
/// <summary>
/// Clears the entire selection. Displayed rows are deselected explicitly to visualize
/// potential transition effects
@ -602,10 +593,6 @@ namespace Avalonia.Controls
return rowIndex + RowGroupHeadersTable.GetIndexCountBeforeGap(0, rowIndex);
}
#endregion Internal Methods
#region Private Methods
private void AddSlotElement(int slot, Control element)
{
#if DEBUG
@ -693,7 +680,7 @@ namespace Avalonia.Controls
}
}
}
private void ClearRows(bool recycle)
{
// Need to clean up recycled rows even if the RowCount is 0
@ -2177,8 +2164,6 @@ namespace Avalonia.Controls
}
}
#endregion Private Methods
private void CollectionViewGroup_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
// If we receive this event when the number of GroupDescriptions is different than what we have already
@ -2779,7 +2764,7 @@ namespace Avalonia.Controls
groupHeader.UpdateTitleElements();
OnLoadingRowGroup(new DataGridRowGroupHeaderEventArgs(groupHeader));
return groupHeader;
}
@ -2804,7 +2789,6 @@ namespace Avalonia.Controls
return null;
}
internal void OnRowGroupHeaderToggled(DataGridRowGroupHeader groupHeader, bool newIsVisibile, bool setCurrent)
{
Debug.Assert(groupHeader.RowGroupInfo.CollectionViewGroup.ItemCount > 0);
@ -2919,8 +2903,6 @@ namespace Avalonia.Controls
}
}
#region Details
// Returns the number of rows with details visible between lowerBound and upperBound exclusive.
// As of now, the caller needs to account for Collapsed slots. This method assumes everything
// is visible
@ -3028,8 +3010,6 @@ namespace Avalonia.Controls
RowDetailsVisibilityChanged?.Invoke(this, e);
}
#endregion
#if DEBUG
internal void PrintRowGroupInfo()
{

22
src/Avalonia.Controls.DataGrid/DataGridTextColumn.cs

@ -17,19 +17,12 @@ namespace Avalonia.Controls
/// </summary>
public class DataGridTextColumn : DataGridBoundColumn
{
#region Constants
#endregion Constants
#region Data
private double? _fontSize;
private FontStyle? _fontStyle;
private FontWeight? _fontWeight;
private IBrush _foreground;
#endregion Data
/// <summary>
/// Initializes a new instance of the <see cref="T:Avalonia.Controls.DataGridTextColumn" /> class.
/// </summary>
@ -38,8 +31,6 @@ namespace Avalonia.Controls
BindingTarget = TextBox.TextProperty;
}
#region DependencyProperties
/// <summary>
/// Identifies the FontFamily dependency property.
/// </summary>
@ -55,10 +46,6 @@ namespace Avalonia.Controls
set { SetValue(FontFamilyProperty, value); }
}
#endregion DependencyProperties
#region Public Properties
/// <summary>
/// Gets or sets the font size.
/// </summary>
@ -137,10 +124,6 @@ namespace Avalonia.Controls
}
}
#endregion Public Properties
#region Protected Methods
/// <summary>
/// Causes the column cell being edited to revert to the specified value.
/// </summary>
@ -357,10 +340,6 @@ namespace Avalonia.Controls
}
}
#endregion Protected Methods
#region Private Methods
private void SetTextFontSize(AvaloniaObject textElement, AvaloniaProperty fontSizeProperty)
{
double newFontSize = FontSize;
@ -374,6 +353,5 @@ namespace Avalonia.Controls
}
}
#endregion Private Methods
}
}

12
src/Avalonia.Controls.DataGrid/EventArgs.cs

@ -90,8 +90,6 @@ namespace Avalonia.Controls
this.EditingEventArgs = editingEventArgs;
}
#region Properties
/// <summary>
/// Gets the column that contains the cell to be edited.
/// </summary>
@ -119,7 +117,6 @@ namespace Avalonia.Controls
private set;
}
#endregion Properties
}
/// <summary>
@ -140,8 +137,6 @@ namespace Avalonia.Controls
EditAction = editAction;
}
#region Properties
/// <summary>
/// The column of the cell that has just exited edit mode.
/// </summary>
@ -169,7 +164,6 @@ namespace Avalonia.Controls
private set;
}
#endregion Properties
}
/// <summary>
@ -239,8 +233,6 @@ namespace Avalonia.Controls
EditAction = editAction;
}
#region Properties
/// <summary>
/// The column of the cell that is about to exit edit mode.
/// </summary>
@ -277,7 +269,6 @@ namespace Avalonia.Controls
private set;
}
#endregion Properties
}
internal class DataGridCellEventArgs : EventArgs
@ -480,8 +471,6 @@ namespace Avalonia.Controls
EditingElement = editingElement;
}
#region Public Properties
/// <summary>
/// Gets the column that contains the cell to be edited.
/// </summary>
@ -518,7 +507,6 @@ namespace Avalonia.Controls
private set;
}
#endregion
}
/// <summary>

2
src/Avalonia.Controls.DataGrid/Primitives/DataGridCellsPresenter.cs

@ -57,7 +57,7 @@ namespace Avalonia.Controls.Primitives
{
return base.ArrangeOverride(finalSize);
}
if (OwningGrid.AutoSizingColumns)
{
// When we initially load an auto-column, we have to wait for all the rows to be measured

3
src/Avalonia.Controls.DataGrid/Primitives/DataGridDetailsPresenter.cs

@ -31,7 +31,7 @@ namespace Avalonia.Controls.Primitives
get { return GetValue(ContentHeightProperty); }
set { SetValue(ContentHeightProperty, value); }
}
internal DataGridRow OwningRow
{
get;
@ -39,7 +39,6 @@ namespace Avalonia.Controls.Primitives
}
private DataGrid OwningGrid => OwningRow?.OwningGrid;
public DataGridDetailsPresenter()
{
AffectsMeasure<DataGridDetailsPresenter>(ContentHeightProperty);

2
src/Avalonia.Controls.DataGrid/Primitives/DataGridRowsPresenter.cs

@ -161,7 +161,7 @@ namespace Avalonia.Controls.Primitives
return new Size(totalCellsWidth + headerWidth, totalHeight);
}
#if DEBUG
internal void PrintChildren()
{

1
src/Avalonia.Controls.DataGrid/Utils/ReflectionHelper.cs

@ -149,7 +149,6 @@ namespace Avalonia.Controls.Utils
return enumerableType;
}
/// <summary>
/// Retrieves the value and type of a property. That property can be nested and its path
/// can include indexers. Each element of the path needs to be a public instance property.

3
src/Avalonia.Controls.DataGrid/Utils/ValidationUtil.cs

@ -131,7 +131,6 @@ namespace Avalonia.Controls.Utils
}
}
/// <summary>
/// Performs an action and catches any non-critical exceptions.
/// </summary>
@ -151,7 +150,7 @@ namespace Avalonia.Controls.Utils
// Catch any non-critical exceptions
}
}
/// <summary>
/// Determines if the specified exception is un-recoverable.
/// </summary>

Loading…
Cancel
Save