You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
774 B
C#
28 lines
774 B
C#
using Avalonia.Data.Converters;
|
|
using System;
|
|
using System.Globalization;
|
|
using System.IO;
|
|
|
|
namespace AI.Converters
|
|
{
|
|
public class FileExtensionConverter : IValueConverter
|
|
{
|
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if (value is string fileName)
|
|
{
|
|
string extension = Path.GetExtension(fileName);
|
|
if (!string.IsNullOrEmpty(extension))
|
|
{
|
|
return extension;
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
} |