ux:Property inside InnerClass?

As far as I know, InnerClass are very similar to Class.
But, apparently I can’t add properties to it.
I keep getting Element was referenced before it was initialized.

Are InnerClass able to receive properties?
Am I doing something wrong?

Small test case:

<App>
    <DockPanel>
        <Panel ux:Name="statusPanel" Color="#f00" Height="80" Dock="Top"/>
        <WhileTrue ux:Name="toggleStatusPanel">
            <Change statusPanel.Color="#0f0" />
        </WhileTrue>

        <Panel ux:InnerClass="MyInnerClass" Height="80" Color="Blue" Margin="5">
	    <string ux:Property="Text" />
	    <Text Value="{ReadProperty Text}" />
            <Clicked>
                <Toggle Target="toggleStatusPanel" />
            </Clicked>
        </Panel>

        <StackPanel>
            <MyInnerClass Text="Hello"/>
            <MyInnerClass />
            <MyInnerClass />
            <MyInnerClass />
        </StackPanel>
    </DockPanel>
</App>

Here is an old Post related -->
https://www.fusetools.com/community/forums/howto_discussions/element_was_referenced_before_it_was_initialized_s?page=1&highlight=998291e3-3190-4a71-901b-c84bc54b333d#post-998291e3-3190-4a71-901b-c84bc54b333d

Thanks for reporting! Excellent reproduction :slight_smile:

I’ve now logged a ticket about this and you can follow the status of it there.

However, we can fix this for you. First, we discourage the use of ux:InnerClass altogether. What you need to do, you can achieve with ux:Dependency on a ux:Class:

<App>
    <DockPanel>
        <Panel ux:Name="statusPanel" Color="#f00" Height="80" Dock="Top" />
        <WhileTrue ux:Name="toggleStatusPanel">
            <Change statusPanel.Color="#0f0" />
        </WhileTrue>

        <StackPanel>
            <MyClass Label="Hello" theTrigger="toggleStatusPanel" />
            <MyClass Label="World" theTrigger="toggleStatusPanel" />
        </StackPanel>
    </DockPanel>

    <Panel ux:Class="MyClass" Height="80" Color="Blue" Margin="5">
        <string ux:Property="Label" />
        <WhileTrue ux:Dependency="theTrigger" />
        <Text Value="{ReadProperty Label}" TextColor="#fff" Alignment="Center" />
        <Clicked>
            <Toggle Target="theTrigger" />
        </Clicked>
    </Panel>
</App>

Thanks for the help, glad to know it was not me.
I have worked around the error using ux:Depenency just liked you mentioned.

Glad you found a workaround! This also appears to be fixed in 1.3 :slight_smile: