Trying to set a color throws an exeption

I have this code snippet and when run it throws an error on the set line

        <Panel ux:Name="tab" Background="#dee" >
            <Clicked>                <Set tab.Background="#f00" />
            </Clicked>
        </Panel>

        E8001: There is nothing named '#f00' in this file, and no global resources with that alias

A bit of a strange error, something must be getting parsed incorrectly

Hi!

The Background property of Panel is actually a shorthand for something like this:

<Panel>
    <Rectangle Layer="Background">
        <SolidColor Color="#f00" />
    </Rectangle>
</Panel>

Atm you cant access Background property as a color the way you are doing here.

The fix, is to use another, slightly more verbose, shorthand. Just put a SolidColor directly on the panel, and give it a name:

<Panel ux:Name="tab">
    <SolidColor ux:Name="bg" Color="#dee"
    <Clicked>    
        <Set bg.Color="#f00" Duration="0.5"/>
    </Clicked>
</Panel>

I hope this helps :slight_smile:

Ah yes that works! Thank you!