Replies: 1 comment
-
If you have a look at the Samples app, and go to the Pages/Views/AvatarView/AvatarViewBindablePropertiesPage.xaml and it's view model ViewModels/Views/AvatarView/AvatarViewBindalbePropertiesViewModel.cs you can see examples of using both an ImageSource AND only a text label. Note that the new AvatarModel
{
Description = "Zoe Saldana",
Text = "ZS",
TextColor = Colors.Yellow,
BackgroundColor = Colors.Blue,
ImageSource = "avatar_icon.png", // Using local MauiImage
BorderWidth = 2,
Padding = 10,
WidthRequest = 64,
HeightRequest = 64,
FontSize = 16,
CornerRadius = new CornerRadius(32),
BorderColor = Colors.Yellow,
FontAttributes = FontAttributes.Bold,
},
new AvatarModel
{
Description = "Sigourney Weaver",
Text = "SW",
TextColor = Colors.Yellow,
BackgroundColor = Colors.Green,
BorderWidth = 3,
Padding = 5,
WidthRequest = 48,
HeightRequest = 64,
FontSize = 14,
CornerRadius = new CornerRadius(16, 16, 0, 0),
BorderColor = Colors.Pink,
FontAttributes = FontAttributes.Bold,
}, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
AvatarView is very useful, but I don't understand why
AvatarView.ImageSource
is not[AllowNull]
.With the current specification, in order to display
AvatarView.Text
, I have to setAvatarView.ImageSource = null;
. However, an NRT warning appears, so I am disabling the warning by usingnull!
.Am I possibly using it incorrectly? If my usage is correct, there might be a need to change it so that
AvatarView.ImageSource = null;
does not produce an NRT warning.Beta Was this translation helpful? Give feedback.
All reactions