-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Edward Miller
committed
Oct 5, 2024
1 parent
7ddd23b
commit 3ee2fd3
Showing
3 changed files
with
41 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 26 additions & 26 deletions
52
Maui.DataGrid/SortDataTypeConverter.cs → ...aGrid/Converters/SortDataTypeConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
namespace Maui.DataGrid; | ||
|
||
using System.ComponentModel; | ||
using System.Globalization; | ||
|
||
/// <summary> | ||
/// Converts string to <see cref="SortData"/> enum. | ||
/// </summary> | ||
public sealed class SortDataTypeConverter : TypeConverter // This needs to be public or it will produce a MethodAccessException | ||
{ | ||
/// <inheritdoc/> | ||
public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value) | ||
{ | ||
if (value == null) | ||
{ | ||
return null; | ||
} | ||
|
||
if (value is int index || int.TryParse(value.ToString(), out index)) | ||
{ | ||
return (SortData)index; | ||
} | ||
|
||
return base.ConvertFrom(context, culture, value); | ||
} | ||
} | ||
namespace Maui.DataGrid.Converters; | ||
|
||
using System.ComponentModel; | ||
using System.Globalization; | ||
|
||
/// <summary> | ||
/// Converts string to <see cref="SortData"/> enum. | ||
/// </summary> | ||
public sealed class SortDataTypeConverter : TypeConverter // This needs to be public or it will produce a MethodAccessException | ||
{ | ||
/// <inheritdoc/> | ||
public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value) | ||
{ | ||
if (value == null) | ||
{ | ||
return null; | ||
} | ||
|
||
if (value is int index || int.TryParse(value.ToString(), out index)) | ||
{ | ||
return (SortData)index; | ||
} | ||
|
||
return base.ConvertFrom(context, culture, value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters