dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.06k stars 1.73k forks source link

Custom BindableProperty on Triggers not working #21992

Open PauchardThomas opened 5 months ago

PauchardThomas commented 5 months ago

Description

I'm trying to update properties on Triggers.

-> Clasic properties as "WidthRequest" are updated / triggers -> BindableProperty created are not updated / triggers

On Windows : Error on startup Microsoft.Maui.Controls.Xaml.XamlParseException : 'Position 16:33. The PropertyName of TagView.MyTagProperty is not MyTag'

On Android :; No error on startup, but not working

https://github.com/dotnet/maui/assets/9884985/c3a90907-28d1-4407-a62b-1bc7d6863d91

Steps to Reproduce

<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
    <s:TagView x:Name="tag" HorizontalOptions="Center" VerticalOptions="Center" WidthRequest="200">
        <s:TagView.Triggers>
            <MultiTrigger TargetType="s:TagView">
                <MultiTrigger.Conditions>
                    <BindingCondition Binding="{Binding Source={x:Reference sw}, Path=IsToggled}" Value="true" />
                </MultiTrigger.Conditions>
                <Setter Property="MyTag" Value="OK" />
                <Setter Property="WidthRequest" Value="400" />
            </MultiTrigger>
        </s:TagView.Triggers>
    </s:TagView>
    <Switch x:Name="sw" />
    <Label Text="{Binding Source={x:Reference tag}, Path=MyTag, StringFormat='MyTag value : {0}'}" />
</StackLayout>

When I toggled the switch button

Expected behavior :

Observed behavior Android :

Observed behavior Windows :

Link to public reproduction project repository

https://github.com/PauchardThomas/MauiTriggerIssue

Version with bug

8.0.3 GA

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows

Affected platform versions

No response

Did you find any workaround?

No

Relevant log output

No response

ninachen03 commented 5 months ago

Verified this issue with Visual Studio 17.10.0 Preview 4 (8.0.0-rc.2.9530 & 8.0.20).I can repro this issue with sample project.

PauchardThomas commented 5 months ago

Any workaround ? It's a pain to migrate from XF....