Articles in this section

How to Implement Real-Time Background Color Changes for User Profiles using the .NET MAUI Color Picker?

This article demonstrates how to implement real-time background color personalization for user profiles using the Syncfusion® .NET MAUI Color Picker in a .NET MAUI application. You can select a color and instantly apply it to an avatar’s background, ideal for account setup screens or profile customization.

  • The interface consists of a grid layout containing two primary components: an avatar view (SfAvatarView) and a color picker control.

  • The avatar is displayed as a circular profile icon, styled with properties such as CornerRadius, Stroke, and AvatarCharacter and is positioned at the top of the layout.

Avatar View

  • Below the avatar, the SfColorPicker is configured with an event handler that triggers when the selected color changes.

Color Picker

XAML:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:inputs="clr-namespace:Syncfusion.Maui.Inputs;assembly=Syncfusion.Maui.Inputs"
             xmlns:sfavatar="clr-namespace:Syncfusion.Maui.Core;assembly=Syncfusion.Maui.Core"
             xmlns:local="clr-namespace:ColorPickerSample"
             x:Class="ColorPickerSample.MainPage">


    <<Grid RowDefinitions="50,150" Margin="80">

        <sfavatar:SfAvatarView x:Name="avatar" Grid.Row="0" ContentType="AvatarCharacter"
                               AvatarCharacter="Avatar29" CornerRadius="60"
                               WidthRequest="120" HeightRequest="120" 
                               Stroke="Black" StrokeThickness="1">
        </sfavatar:SfAvatarView>
    
        <inputs:SfColorPicker x:Name="colorPicker" Grid.Row="1" ColorChanged="PaletteColorChanged"/>
    
    </Grid>

</ContentPage>

The ColorChanged event of the color picker is used to detect when a new color is selected. The selected color is retrieved and immediately applied to the avatar’s background. This creates a responsive and interactive experience, allowing the avatar’s appearance to update in real time based on user input.

C#:

public partial class MainPage : ContentPage
{
    public MainPage()
    {
        InitializeComponent();
    }

    private void PaletteColorChanged(object sender, Syncfusion.Maui.Inputs.ColorChangedEventArgs e)
    {
        avatar.Background = e.NewColor;
    }
}

Output:

User Profile Customization

Download the complete sample from GitHub.

Conclusion

I hope you enjoyed learning how to implement real-time background color personalization for user profiles in the .NET MAUI Color Picker (SfColorPicker).

Refer to our .NET MAUI Color Picker feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications.
For current customers, check out our components from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our other controls.

If you have any queries or require clarification, 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