<Match> inside ux:Class

I’m trying to use <Match> with ux:Property and I’m getting E2009: Call to 'Fuse.Controls.PropertyBinding<object>(Uno.UX.Property<object>,Uno.UX.Property<object>)' has some invalid arguments

How is flow control with properties supported?


For a property binding, the source and desitination properties must have identical type (known limitiation). If you post the full code, I can help spot the error.

    <StackPanel ux:Class="DateItemTemplate" ux:Name="self" ClipToBounds="false" Margin="0" Background="#fff">
        <string ux:Property="Day" />
        <string ux:Property="Date" />
        <float4 ux:Property="TextColor" />
        <float4 ux:Property="LineColor" />
        <Match Value="{Property self.Day}">
            <Case String="Mon">
                <Text Value="{Property self.Day}" TextColor="{Property self.TextColor}" Font="RobotoMedium" Alignment="Center" FontSize="13" />
        <Text Value="{Property self.Date}" TextColor="{Property self.TextColor}" Font="RobotoMedium" Alignment="Center" FontSize="20" />
        <Rectangle Height="3" Width="74">
            <SolidColor Color="{Property self.LineColor}" />

Match.Value is of type object and cannot be property-bound to a string in 0.11. This is a known limitation and we have a ticket for improving it.

A work-around for now is using <Match String="{Property self.Day}">

Just wanted to bring up the fact that it has been this way since 0.11 (current version is 0.25.1). Is this still something that is going to be “fixed” or has it been cancelled/re-evaluated and not going to change?

It caused me some headache while migrating code from using observables (<Match Value="{someVar}"> <Case String="someValue"> ...) to using ux:Property(ies) (<Match String="{Property this.aProperty}"> <Case String="someString"> ...) inside a ux:Class.

The error message seemed to say something was wrong with the types I was declaring for each ux:Property instead of being related to Match:

E8001: Cannot bind property 'Value' (object) to 'FileNewStatus' (bool), the types don't match. If you created the property 'FileNewStatus', consider changing its type to 'object'.

Changing <bool ux:Property="FileNewStatus" /> to <object ux:Property="FileNewStatus" /> as the error seems to suggest doesn’t fix the issue, as noted.


Not really sure what you mean, but best practice now is as follows:

Instead of

    <Match Value="{foo}">
       <Case String="bar" > 
           <Panel> ...


<Each MatchKey="foo">
     <Panel ux:Template="bar">...