Set Fill Brush in a Class

I have a Class Card and I want each Card to have a different background color:

<Each Items="{cards}">
  <Card BgColor="{colorvar}" />
</Each>

Here is my Class:

  <Panel ux:Class="Card" ux:Name="Card" Padding="15">
      <Brush ux:Property="BgColor"/>

      <Rectangle CornerRadius="4" Fill="{Property Card.BgColor}" Layer="Background" />
  </Panel>

But all I get is ERROR: Object reference not set to an instance of an object and a blank (no error, just blank) preview that I have to rebuild.

Note that outside of a Class, it works: <Circle Fill="{colorvar}" /> works fine.

Hi!

Try setting an initial value for the property, e.g.

<Panel ux:Class="Card" ux:Name="Card" Padding="15" BgColor="Black">

Works fine! Thanks