[Proposal] AvatarView
See original GitHub issueAvatarView
- Proposed
- Prototype: Not Started
- Implementation
- iOS Support
- Android Support
- macOS Support
- Windows Support
- Unit Tests
- Sample
- Documentation
Summary
Allows the user to display an avatar or the user’s initials if no avatar is available
Detailed Design
AvatarView.shared.cs
public class AvatarView : BaseTemplatedView<Frame>
{
public static readonly BindableProperty AspectProperty;
public static readonly BindableProperty SizeProperty;
public static readonly BindableProperty CornerRadiusProperty;
public static readonly BindableProperty BorderColorProperty;
public static readonly BindableProperty ColorProperty;
public static readonly BindableProperty SourceProperty;
public static readonly BindableProperty TextProperty;
public static readonly BindableProperty TextColorProperty;
public static readonly BindableProperty FontFamilyProperty;
public static readonly BindableProperty FontSizeProperty;
public static readonly BindableProperty FontAttributesProperty;
public static readonly BindableProperty ColorThemeProperty;
public Aspect Aspect { get; set; }
public double Size { get; set; }
public double CornerRadius { get; set; }
public Color BorderColor { get; set; }
public Color Color { get; set; }
public ImageSource? Source { get; set; }
public string? Text { get; set; }
public Color { get; set; }
public string? FontFamily { get; set; }
[TypeConverter(typeof(FontSizeConverter))]
public double FontSize { get; set; }
public FontAttributes FontAttributes { get; set; }
public IColorTheme ColorTheme { get; set; }
}
Usage Syntax
XAML Usage
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
x:Class="MyLittleApp.MainPage">
<StackLayout>
<xct:AvatarView Text="{Binding Initials}" Source="{Binding AvatarSource}" />
</StackLayout>
</ContentPage>
C# Usage
class MyPage : ContentPage
{
public MyPage()
{
Content = ContentPage
{
new AvatarView()
.Bind(AvatarView.InitialsProperty, nameof(ViewModel.Initials))
.Bind(AvatarView.AvatarSourceProperty, nameof(ViewModel.AvatarSource))
}
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
GetStream/avatarview-android
GitHub - GetStream/avatarview-android: ✨ Supports loading profile images with fractional styles, shapes, borders, indicators, and initials for Android.
Read more >AvatarView - .NET MAUI Community Toolkit
The CommunityToolKit MAUI AvatarView is a control for displaying a user's avatar image or their initials. Avatars can be text, image, ...
Read more >Playercharacter as Avatar view
Hello, I hope my question is in the right category on this forum: Is it possible to do something like this (1) on...
Read more >Avatar View for Android Apps
There are many libraries that offer creating rounded avatars… ... have decided to implement Avatar View with Android data binding support.
Read more >How to show badges in Xamarin.Forms Avatar View ...
The following section explains how to show the badges on SfAvatarView. Refer SfAvatarView and SfBadgeView getting started documentation to create a simple ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bijington In answer to your questions/points, some of which MAY be answered by the ‘draft’ pull I made as suggested by @brminnick . However, I think more questions will be raised as we look at the porpoal WIP code.
I have created a fork, and appropriately named branch, to work on some options for this proposal.
See 104-AvatarView for the work-in-progress code branch.
I am incredibly open to suggestions, comments, raised issues, and looking for some guidance from the community veterans.
Ideally, I’d like to achieve the following, to make the control as extensible and customisable by the end user as possible, using known and standard control properties. These are my personal objectives for the control, and open to discussion/review: