Idk, dev work goin on
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Markup;
|
||||
|
||||
namespace WinWARP.Ui.Converters;
|
||||
|
||||
[MarkupExtensionReturnType(ReturnType = typeof(IValueConverter))]
|
||||
public class CountryCodeToUriConverter : MarkupExtension, IValueConverter
|
||||
{
|
||||
protected override object ProvideValue() => this;
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is string countryCode)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(countryCode))
|
||||
{
|
||||
return new Uri($"ms-appx:///Assets/Flags/{countryCode.ToLower()}.svg");
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Uri("ms-appx:///Assets/Flags/xx.svg");
|
||||
}
|
||||
}
|
||||
else return null;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language) => throw new NotImplementedException();
|
||||
}
|
||||
Reference in New Issue
Block a user