Get profile image import working

This commit is contained in:
TheXamlGuy
2024-06-28 21:58:44 +01:00
parent f933afc24f
commit e19a963f8e
3 changed files with 36 additions and 0 deletions
@@ -0,0 +1,34 @@
using Avalonia.Data.Converters;
using Avalonia.Markup.Xaml;
using System.Globalization;
using Toolkit.Foundation;
namespace Toolkit.UI.Avalonia;
public class ImageDescriptorToBitmapConverter :
MarkupExtension,
IValueConverter
{
public object? Convert(object? value,
Type targetType,
object? parameter,
CultureInfo culture)
{
if (value is IImageDescriptor imageDescriptor)
{
return imageDescriptor.Image;
}
return default;
}
public object? ConvertBack(object? value,
Type targetType,
object? parameter,
CultureInfo culture)
{
throw new NotImplementedException();
}
public override object ProvideValue(IServiceProvider serviceProvider) => this;
}
@@ -55,6 +55,7 @@
x:Name="PersonPictureEllipse" x:Name="PersonPictureEllipse"
Width="{TemplateBinding Width}" Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}" Height="{TemplateBinding Height}"
Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ActualImageBrush}"
FlowDirection="LeftToRight" /> FlowDirection="LeftToRight" />
<Grid <Grid
x:Name="BadgeGrid" x:Name="BadgeGrid"
@@ -157,6 +157,7 @@ public class PersonPicture : TemplatedControl
if (change.Property == ProfilePictureProperty) if (change.Property == ProfilePictureProperty)
{ {
UpdateIfReady();
} }
} }