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" />

        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


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

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

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"
        <Set bg.Color="#f00" Duration="0.5"/>

I hope this helps :slight_smile:

Ah yes that works! Thank you!