I am trying to get a subclass of the Xamarin Forms "Label" class. In my subclass, among a lot of other changes, I want to have a different default value for some bindable properties (such as FontSize and FontAttributes). However, if I set these in the constructor, it seems that Style specifiers won't override these, presumably because the bindings are already noticing that they are using non-default values. Is there a way to specify in a subclass that you want to use different default values in a bindable property?
class MyCustomLabel : Label {
public MyCustomLabel() {
FontSize=20;
}
}
<ResourceDictionary>
<Style x:Key="Superbig" TargetType="MyCustomLabel">
<Setter Property="FontSize" Value="3" />
</Style>
</ResourceDictionary>
<MyCustomLabel Style="{StaticResource Superbig}" Text="Hi There!" />
Here, the Superbig style is not being applied because I am setting the new default value in the constructor. Therefore, I was hoping either (a) there was some other way to set a new default value, or (b) there was some other way to set a style so it overrode any value that was already set.