Skip to content

Commit

Permalink
switch to Debug.WriteLine()
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Miller committed Sep 3, 2023
1 parent 2a3cb73 commit 36d00bf
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Maui.DataGrid/DataGrid.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Maui.DataGrid;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows.Input;
using Maui.DataGrid.Extensions;
using Microsoft.Maui.Controls.Shapes;
Expand Down Expand Up @@ -65,51 +66,51 @@ private bool CanSort(SortData? sortData)
{
if (sortData is null)
{
Console.WriteLine("No sort data");
Debug.WriteLine("No sort data");
return false;
}

if (InternalItems is null)
{
Console.WriteLine("There are no items to sort");
Debug.WriteLine("There are no items to sort");
return false;
}

if (!IsSortable)
{
Console.WriteLine("DataGrid is not sortable");
Debug.WriteLine("DataGrid is not sortable");
return false;
}

if (Columns.Count < 1)
{
Console.WriteLine("There are no columns on this DataGrid.");
Debug.WriteLine("There are no columns on this DataGrid.");
return false;
}

if (sortData.Index >= Columns.Count)
{
Console.WriteLine("Sort index is out of range");
Debug.WriteLine("Sort index is out of range");
return false;
}

var columnToSort = Columns[sortData.Index];

if (columnToSort.PropertyName == null)
{
Console.WriteLine($"Please set the {nameof(columnToSort.PropertyName)} of the column");
Debug.WriteLine($"Please set the {nameof(columnToSort.PropertyName)} of the column");
return false;
}

if (!columnToSort.SortingEnabled)
{
Console.WriteLine($"{columnToSort.PropertyName} column does not have sorting enabled");
Debug.WriteLine($"{columnToSort.PropertyName} column does not have sorting enabled");
return false;
}

if (!columnToSort.IsSortable(this))
{
Console.WriteLine($"{columnToSort.PropertyName} column is not sortable");
Debug.WriteLine($"{columnToSort.PropertyName} column is not sortable");
return false;
}

Expand Down

0 comments on commit 36d00bf

Please sign in to comment.