We’ve received quite a few bug reports and change suggestions for the recently introduced ux:Property
feature. Based on your feedback, we’ve made lots of fixes and improvements.
This leads to the following changes:
A node marked with ux:Property
no longer represents the default value, but just a definition of the property. The default value has to be specified either on the containing class node, for example:
<App Theme="Basic">
<Panel ux:Class="MyPanel" ux:Name="self" Paint="#f00">
<Brush ux:Property="Paint"/>
<Rectangle Fill="{Property self.Paint}"/>
</Panel>
<Panel>
<MyPanel Paint="#00f" />
</Panel>
</App>
Or, you can use ux:Binding
to set a complex object as default value:
<Panel ux:Class="MyPanel" ux:Name="self" >
<Brush ux:Property="Paint"/>
<LinearGradient ux:Binding="Paint">
<GradientStop Offset="0" Color="#f00" />
<GradientStop Offset="1" Color="#0f0" />
</LinearGradient>
<Rectangle Fill="{Property self.Paint}"/>
</Panel>
With this new syntax, you can define a propery of a base class, and use a derived class as default value, like here. This in turn fixes {Property foo}
bindings which require source and destination to be the exact same type.