Skip to content

[BUG] AvatarView not applying style from resources #3241

@Dadibe

Description

@Dadibe

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

If you define AvatarView Style property value using ContentPage Resource like below,

	<ContentPage.Resources>
		<Style TargetType="toolkit:AvatarView">
			<Setter Property="StrokeThickness"
							Value="5" />
			<Setter Property="Stroke"
							Value="Red" />	
		</Style>
	</ContentPage.Resources>
	
	<toolkit:AvatarView Text="DA"/>

the AvatarView will not apply the style, but when assigned directly

<toolkit:AvatarView Text="DA" StrokeThickness="5" Stroke="Red"/>

it will apply the settings

Expected Behavior

The setting should be applied either when set via style or directly

Steps To Reproduce

  1. Open and run the reproduction project
  2. Observe the AvatarView, the styling in the ContentPage Resources will not apply
  3. Set the styling directly and run again, the styling will apply

Link to public reproduction project repository

https://github.com/Dadibe/AvatarView-Style.git

Environment

- .NET MAUI CommunityToolkit: 14.2.0
- OS: Windows 11 Pro Build 22000.2538
- .NET MAUI: 10.0.301

Anything else?

Tested on Android only (both on Emulator and Physical Device)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions