Articles in this section

How to show badges in .NET MAUI Avatar View (SfAvatarView)?

To integrate the .NET MAUI Avatar View control with the .NET MAUI Badge View and showcase badges, follow the below steps:

Step 1: Initialize Avatar View in the Content of Badge View
Create an instance of the Avatar View control with the required parameters. Nest this Avatar View instance within a Badge View control.

XAML

<Grid >
    <sfbadge:SfBadgeView x:Name="badge"
                         HorizontalOptions="Center" 
                         VerticalOptions="Center">
        <sfbadge:SfBadgeView.Content>
            <Grid>
                <sfavatar:SfAvatarView ContentType="Initials"
                                       AvatarName="Alex" 
                                       VerticalOptions="Center"
                                       HorizontalOptions="Center"   
                                       HeightRequest="50"
                                       CornerRadius="25"
                                       WidthRequest="50" />
            </Grid>
        </sfbadge:SfBadgeView.Content>
      </sfbadge:SfBadgeView>
</Grid>

Step 2: Set Content property and BadgeSettings property
Assign the Avatar View instance to the Content property of the Badge View. Define the BadgeSettings property to position the badge at the bottom-right corner.

C#

<Grid >
    <sfbadge:SfBadgeView x:Name="badge"
                         HorizontalOptions="Center"
                         VerticalOptions="Center">
        <sfbadge:SfBadgeView.Content>
            <Grid>
                <sfavatar:SfAvatarView ContentType="Initials"
                                       AvatarName="Alex"
                                       VerticalOptions="Center"
                                       HorizontalOptions="Center"  
                                       HeightRequest="50"
                                       CornerRadius="25"
                                       WidthRequest="50" />
            </Grid>
        </sfbadge:SfBadgeView.Content>
        <sfbadge:SfBadgeView.BadgeSettings>
            <sfbadge:BadgeSettings  Type="Success"
                                    Position="BottomRight"
                                    Icon="Available"/>
        </sfbadge:SfBadgeView.BadgeSettings>
     </sfbadge:SfBadgeView>
</Grid>

Output

Screenshot 2023-08-07 164531.jpg

Conclusion

I hope you enjoyed learning how to show badges in the.NET MAUI Avatar View (SfAvatarView).

You can refer to our .NET MAUI Avatar View’s feature tour page to learn about its other groundbreaking feature representations. Explore our .NET MAUI Avatar View documentation to understand how to present and manipulate data.

For current customers, you can check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our .NET MAUI Avatar View and other .NET MAUI components.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied