Add project files
This commit is contained in:
commit
97cafcfa18
16 files changed
+1540
No files matched your search
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
|
||||
namespace NexvaneHub.Converters;
|
||||
|
||||
/// <summary>
|
||||
/// Compares a bound enum value's string representation against ConverterParameter.
|
||||
/// Used for "is this nav item selected" / "is this section visible" bindings.
|
||||
/// </summary>
|
||||
public class EnumEqualsConverter : IValueConverter
|
||||
{
|
||||
public static readonly EnumEqualsConverter Instance = new();
|
||||
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is null || parameter is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return string.Equals(value.ToString(), parameter.ToString(), StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user