Property binding error

I can’t binding a property to the while value.

        <Panel ux:Class="Example" Name="self">
            <string ux:Property="Value" ux:Value="false" />
            <WhileFalse Value="{Property self.Value}">
                <Rectangle Fill="#000" Width="30" Height="30" />
            </WhileFalse>
        </Panel>

I got this error:

ERROR: Constructor on type ‘Fuse.Controls.PropertyBinding`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]’ not found.

I am really stuck with this, what am I doing wrong?

Hi!

WhileFalse expects a bool, not a string.

Try

<bool ux:Property="Value" ux:Value="false" />

This should work in the current version (0.9.5) as long as this is kept in the main file.

There are known bugs with this feature that are fixed and will be available in an upcoming release

Thank you, that solves the error. I have another question related to this, why swColor is always false? I thought the toggle would change the value of swColor, instead I have to change its value in my JavaScript.

var swColor = Observable(false);

    <Panel ux:Class="Example" Width="32" Height="32" Name="self">
      <bool ux:Property="Value" ux:Value="false" />
      <SolidColor Color="#000" ux:Name="panelColor" />
      <WhileTrue Value="{Property self.Value}" ux:Name="state">
          <Change panelColor.Color="#fff" />
      </WhileTrue>
      <Clicked>
          <Toggle Target="state" />
      </Clicked>
    </Panel>

<Example Value="{swColor}" />

Hmm, good question. I will investigate!

Does this happen in preview, in exported apps, or both?

In both cases, preview and exported apps in Android.

I believe I’ve identified the bug causing this not to work. I’ve filed it under #1272. It’s an issue with 2-way data binding on WhileValue. You just happened upon a combination we didn’t cover with our use-cases.

Hi,

WhileTrue does not participate in two-way value binding. Replace Toggle with Change:

<Clicked>
    <Change self.Value="true" />
</Clicked>

Unfortunately, there is currently no way to “toggle” a boolean UX property from UX.