Get profile image import working
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user