I am trying to make a custom Panel class that will set properties to an inner Text node. I was able to pass most of Text’s properties but FontSize
is not accepted. Here’s the sample code:
<Panel>
<Panel ux:Class="Icon" Width="32" Height="32" TextColor="{Resource darkBlue}" FontSize="12" Value="">
<float ux:Property="FontSize" />
<string ux:Property="Value" />
<float4 ux:Property="TextColor" />
<TextAlignment ux:Property="TextAlignment" />
<Text Font="IconFont" TextColor="{Property this.TextColor}" TextAlignment="{Property this.TextAlignment}" FontSize="{Property this.FontSize}" Value="{Property this.Value}" />
</Panel>
<Icon FontSize="20" Value=""/>
</Panel>
However I get an error on <float ux:Property="FontSize" />
:
....\build\Local\Preview66\cache\Icon.g.uno(99.21): E2009: Call to 'Fuse.Controls.PropertyBinding<float>(Uno.UX.Property<float>,Uno.UX.Property<float>)' has some invalid arguments (TowardDemo_FuseControlsText_FontSize_Property,TowardDemo_Icon_FontSize_Property)
....\build\Local\Preview66\cache\MainView.g.uno(1566.17): E3107: 'Icon' does not contain a member called 'FontSizeProperty'. Could you be missing a package reference?
Documentation says FontSize
is of type float
so I don’t know what’s going on here.
I tried changing the Property to <float ux:Property="IconSize" />
and the same error happens:
build\Local\Preview74\cache\MainView.g.uno(1563.17): E3107: 'Icon' does not contain a member called 'IconSizeProperty'. Could you be missing a package reference?
Hi,
Sorry for the late reply. Looks like you are trying to set the custom FontSize proeprty from a Style
, which is deprecated.
Let us know if the problem persists after eliminating styles from your project.
Hi Anders,
I don’t use Style
in my code at all since it’s been deprecated. I converted all of my Style
blocks to ux:Classes
like the one above.
Hi,
A new big release is right around the corner. If the problem persists there, can you provide a full test case please?
After closer investigation this appears to be a bug in the current version (0.12.x) and I don’t have a good suggestion for a work-around for the bug. Sorry for the inconveniecne.
The good news is that I am unable to reproduce the issue in the next version that will be released soon. (I expect this version to go on #pre-release-testing some time today.)
Hi Anders, thank you for the reply.
I also noticed that if I create an ux:Class
and try to add a ux:Property
to an instance of it, I get the same errors as above (on 0.12.4):
<Panel ux:Class="RoundButton" Label="Click Me">
<string ux:Property="Label">
<Text Value="{Property this.Label}" Alignment="Center" />
</Panel>
<RoundButton Diameter="100" ux:Name="firstButton">
<!-- Adding a property to an instance of a ux:Class -->
<Size ux:Property="Diameter" />
<Circle Width="{Property firstButton.Diameter}" Height="{Property firstButton.Diameter}" Fill="#FF0000" Layer="Background" />
</RoundButton>
Error: MainView.g.uno(1563.17): E3107: 'RoundButton' does not contain a member called 'Diameter'. Could you be missing a package reference?
You cannot add ux:Property
to an instance, only to ux:Class
'es.
The error message is poor, though. I’ll take note of that.