Skip to content

Commit

Permalink
remove parameter on IsSortable
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Miller committed Dec 29, 2023
1 parent e75a119 commit a2f3688
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
14 changes: 14 additions & 0 deletions Maui.DataGrid/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,20 @@
<Right>lib/net7.0/Maui.DataGrid.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Maui.DataGrid.DataGridColumn.IsSortable</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.DataGridColumn.IsSortable(Maui.DataGrid.DataGrid)</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.DataGridColumn.set_EditCellTemplate(Microsoft.Maui.Controls.DataTemplate)</Target>
Expand Down
4 changes: 2 additions & 2 deletions Maui.DataGrid/DataGrid.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private bool CanSort(SortData? sortData)
return false;
}

if (!columnToSort.IsSortable(this))
if (!columnToSort.IsSortable())
{
Debug.WriteLine($"{columnToSort.PropertyName} column is not sortable");
return false;
Expand Down Expand Up @@ -1220,7 +1220,7 @@ private View GetHeaderViewForColumn(DataGridColumn column)
{
column.HeaderLabel.Style = column.HeaderLabelStyle ?? HeaderLabelStyle ?? _defaultHeaderStyle;

if (!IsSortable || !column.SortingEnabled || !column.IsSortable(this))
if (!IsSortable || !column.SortingEnabled || !column.IsSortable())
{
return new ContentView
{
Expand Down
5 changes: 2 additions & 3 deletions Maui.DataGrid/DataGridColumn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ public Style HeaderLabelStyle
/// Determines via reflection if the column's data type is sortable.
/// If you want to disable sorting for specific column please use <see cref="SortingEnabled"/> property
/// </summary>
/// <param name="dataGrid">The <see cref="DataGrid"/> to sort for.</param>
public bool IsSortable(DataGrid dataGrid)
public bool IsSortable()
{
if (_isSortable is not null)
{
Expand All @@ -336,7 +335,7 @@ public bool IsSortable(DataGrid dataGrid)

try
{
if (dataGrid?.ItemsSource is null)
if (DataGrid?.ItemsSource is null)
{
_isSortable = false;
}
Expand Down

0 comments on commit a2f3688

Please sign in to comment.