MauiIcons icon indicating copy to clipboard operation
MauiIcons copied to clipboard

Icons does not appearing when using Style and Trigger Setter's

Open uom42 opened this issue 4 months ago • 3 comments

Describe the bug If the Label.Text property is set from XAML markup - the icons is displayed. But if the Text property is set from Style.Setter, the icons is not displayed.

To Reproduce Set Label.Text property in XAML markup: <Label Text="{mi:MaterialOutlined Icon=ArrowDropUp, IconColor={StaticResource Primary}}" /> result: Screenshot_1709437268

use Styles:

<Label>
	<Label.Style>
		<Style TargetType="Label">
			<Setter Property="Text" Value="{mi:MaterialOutlined Icon=ArrowDropDown, IconColor={StaticResource Primary}}" />
		</Style>
	</Label.Style>
</Label>

result: Screenshot_1709437320

Expected behavior use Styles:

<Label>
	<Label.Style>
		<Style TargetType="Label">
			<Setter Property="Text" Value="{mi:MaterialOutlined Icon=ArrowDropDown, IconColor={StaticResource Primary}}" />
		</Style>
	</Label.Style>
</Label>

result: Screenshot_1709437268

Additional context API33 Android 13.0 <TargetFrameworks>net8.0-android</TargetFrameworks>

uom42 avatar Mar 03 '24 04:03 uom42

Describe the bug If the Label.Text property is set from XAML markup - the icons is displayed. But if the Text property is set from Style.Setter, the icons is not displayed.

To Reproduce Set Label.Text property in XAML markup: <Label Text="{mi:MaterialOutlined Icon=ArrowDropUp, IconColor={StaticResource Primary}}" /> result: Screenshot_1709437268

use Styles:

<Label>
	<Label.Style>
		<Style TargetType="Label">
			<Setter Property="Text" Value="{mi:MaterialOutlined Icon=ArrowDropDown, IconColor={StaticResource Primary}}" />
		</Style>
	</Label.Style>
</Label>

result: Screenshot_1709437320

Expected behavior use Styles:

<Label>
	<Label.Style>
		<Style TargetType="Label">
			<Setter Property="Text" Value="{mi:MaterialOutlined Icon=ArrowDropDown, IconColor={StaticResource Primary}}" />
		</Style>
	</Label.Style>
</Label>

result: Screenshot_1709437268

Additional context API33 Android 13.0 <TargetFrameworks>net8.0-android</TargetFrameworks>

Thanks for reporting, I guess this scenario is rarely used, seems like we don't have test for it yet or nor a complete implementation to support style setter. Will release a patch with fix for this as soon as possible.

AathifMahir avatar Mar 03 '24 09:03 AathifMahir

...I guess this scenario is rarely used...

I think this should have widespread use:

You can use Setter's not only with styles (I just gave styles as an example), but also in triggers - they have the same Setter's. For example, buttons that change their state (icon) - now I am forced to create several buttons and hide unnecessary ones, instead of just changing the button icon through a trigger.

uom42 avatar Mar 04 '24 04:03 uom42

...I guess this scenario is rarely used...

I think this should have widespread use:

You can use Setter's not only with styles (I just gave styles as an example), but also in triggers - they have the same Setter's. For example, buttons that change their state (icon) - now I am forced to create several buttons and hide unnecessary ones, instead of just changing the button icon through a trigger.

Yeah, I know

When we setting up a roadmap for v2, there's no request regarding support for multitrigger, triggers or setter support from devs. Therefore we mainly focused on supporting Xaml Markup Extension Across Different Controls.

Anyway, this feature request would be great starting point for supporting all Maui triggers and setters.

I'd really appreciate, if you share me sample of Xaml that uses Multitrigger, Single trigger and Setters that covers the whole use case.

AathifMahir avatar Mar 04 '24 16:03 AathifMahir

Hey, is this fixed in v3.0.0?

Blackfishbox avatar May 25 '24 20:05 Blackfishbox

Hey, is this fixed in v3.0.0?

This feature is not part of v3

AathifMahir avatar May 25 '24 20:05 AathifMahir