Reputation: 191
In a nuget package there is an Xaml file with:
<Style x:Key="LabelBase" TargetType="Label">
<Setter Property="TextColor" Value="Green" />
</Style>
<Style
BasedOn="{StaticResource LabelBase}"
Class="Primary"
TargetType="Label">
</Style>
In the current project App.xaml I have:
<Style TargetType="Label">
<Setter Property="TextColor" Value="Red" />
</Style>
The ResourceDictionary has MergedWith="XAMLFILE"
, the nuget .xaml file ResourceDictionary.
In the AbsoluteLayout of a page I have a label
<Label
Grid.Row="0"
FontSize="45"
HorizontalTextAlignment="Center"
StyleClass="Primary"
Text="Text Value"
VerticalOptions="Center" />
How do I override the Primary StyleClass in my projects App.Xaml to get the text color to inherit red without creating a new styleclass?
Upvotes: 0
Views: 578
Reputation: 16572
If you want that Theme to be applied to all the labels just remove the class and it should work :
<Style
BasedOn="{StaticResource LabelBase}"
TargetType="Label">
</Style>
See to it you do not have a key and that the style is in APP.xaml
Good luck
Feel free to revert.
Upvotes: 2