Skip to content

Commit

Permalink
rename property for consistency, but keep old one around as obsolete …
Browse files Browse the repository at this point in the history
…for awhile
  • Loading branch information
Edward Miller committed Mar 23, 2024
1 parent 2f9a1b3 commit 76360c3
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Maui.DataGrid.Sample/Tests/PropertyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void TestPropertiesSetsProperly()
TestProperty(DataGrid.HeaderBordersVisibleProperty, true, false);
TestProperty(DataGrid.HeaderHeightProperty, 42, 44);
TestProperty(DataGrid.IsRefreshingProperty, true, false);
TestProperty(DataGrid.IsSortableProperty, true, false);
TestProperty(DataGrid.SortingEnabledProperty, true, false);
TestProperty(DataGrid.ItemSizingStrategyProperty, ItemSizingStrategy.MeasureAllItems, ItemSizingStrategy.MeasureFirstItem);
TestProperty(DataGrid.ItemsSourceProperty, new[] { "a", "b", "c" }, new[] { "d", "e" });
TestProperty(DataGrid.NoDataViewProperty, new ContentView { Background = Colors.Aqua }, new ContentView { Background = Colors.Lime });
Expand Down
42 changes: 42 additions & 0 deletions Maui.DataGrid/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
<Right>lib/net7.0/Maui.DataGrid.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:Maui.DataGrid.DataGrid.SortingEnabledProperty</Target>
<Left>lib/net7.0/Maui.DataGrid.dll</Left>
<Right>lib/net7.0/Maui.DataGrid.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Maui.DataGrid.DataGrid.get_PageSizeList</Target>
Expand Down Expand Up @@ -78,6 +85,13 @@
<Right>lib/net7.0/Maui.DataGrid.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Maui.DataGrid.DataGrid.get_SortingEnabled</Target>
<Left>lib/net7.0/Maui.DataGrid.dll</Left>
<Right>lib/net7.0/Maui.DataGrid.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Maui.DataGrid.DataGrid.set_PullToRefreshCommandParameter(System.Object)</Target>
Expand Down Expand Up @@ -113,6 +127,13 @@
<Right>lib/net7.0/Maui.DataGrid.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Maui.DataGrid.DataGrid.set_SortingEnabled(System.Boolean)</Target>
<Left>lib/net7.0/Maui.DataGrid.dll</Left>
<Right>lib/net7.0/Maui.DataGrid.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:Maui.DataGrid.DataGrid.PullToRefreshCommandParameterProperty</Target>
Expand Down Expand Up @@ -148,6 +169,13 @@
<Right>lib/net8.0/Maui.DataGrid.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:Maui.DataGrid.DataGrid.SortingEnabledProperty</Target>
<Left>lib/net8.0/Maui.DataGrid.dll</Left>
<Right>lib/net8.0/Maui.DataGrid.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Maui.DataGrid.DataGrid.get_PageSizeList</Target>
Expand Down Expand Up @@ -190,6 +218,13 @@
<Right>lib/net8.0/Maui.DataGrid.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Maui.DataGrid.DataGrid.get_SortingEnabled</Target>
<Left>lib/net8.0/Maui.DataGrid.dll</Left>
<Right>lib/net8.0/Maui.DataGrid.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Maui.DataGrid.DataGrid.set_PullToRefreshCommandParameter(System.Object)</Target>
Expand Down Expand Up @@ -225,4 +260,11 @@
<Right>lib/net8.0/Maui.DataGrid.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Maui.DataGrid.DataGrid.set_SortingEnabled(System.Boolean)</Target>
<Left>lib/net8.0/Maui.DataGrid.dll</Left>
<Right>lib/net8.0/Maui.DataGrid.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
28 changes: 22 additions & 6 deletions Maui.DataGrid/DataGrid.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,17 @@ private void SortAndPaginate(SortData? sortData = null)
BindablePropertyExtensions.Create<DataGrid, int>(40);

/// <summary>
/// Gets or sets a value indicating whether the DataGrid is sortable.
/// Gets or sets a value indicating whether the DataGrid allows sorting.
/// </summary>
public static readonly BindableProperty IsSortableProperty =
public static readonly BindableProperty SortingEnabledProperty =
BindablePropertyExtensions.Create<DataGrid, bool>(true);

/// <summary>
/// Obsolete. Use <see cref="SortingEnabledProperty"/> instead.
/// </summary>
[Obsolete("IsSortableProperty is obsolete. Please use SortingEnabledProperty instead.")]
public static readonly BindableProperty IsSortableProperty = SortingEnabledProperty;

/// <summary>
/// Gets or sets the font size for the DataGrid.
/// </summary>
Expand Down Expand Up @@ -1017,14 +1023,24 @@ public int HeaderHeight
}

/// <summary>
/// Gets or sets if the grid is sortable. Default value is true.
/// Obsolete. Use <see cref="SortingEnabled"/> instead.
/// </summary>
[Obsolete("IsSortable is obsolete. Please use SortingEnabled instead.")]
public bool IsSortable
{
get => (bool)GetValue(SortingEnabledProperty);
set => SetValue(SortingEnabledProperty, value);
}

/// <summary>
/// Gets or sets if the grid allows sorting. Default value is true.
/// Sortable columns must implement <see cref="IComparable"/>
/// If you want to enable or disable sorting for specific column please use <see cref="DataGridColumn.SortingEnabled"/> property
/// </summary>
public bool IsSortable
public bool SortingEnabled
{
get => (bool)GetValue(IsSortableProperty);
set => SetValue(IsSortableProperty, value);
get => (bool)GetValue(SortingEnabledProperty);
set => SetValue(SortingEnabledProperty, value);
}

/// <summary>
Expand Down

0 comments on commit 76360c3

Please sign in to comment.