【发布时间】:2019-09-03 10:59:00
【问题描述】:
在 nuget 包中有一个 Xaml 文件,其中包含:
<Style x:Key="LabelBase" TargetType="Label">
<Setter Property="TextColor" Value="Green" />
</Style>
<Style
BasedOn="{StaticResource LabelBase}"
Class="Primary"
TargetType="Label">
</Style>
在当前项目 App.xaml 我有:
<Style TargetType="Label">
<Setter Property="TextColor" Value="Red" />
</Style>
ResourceDictionary 有 MergedWith="XAMLFILE",nuget .xaml 文件 ResourceDictionary。
在页面的 AbsoluteLayout 中我有一个标签
<Label
Grid.Row="0"
FontSize="45"
HorizontalTextAlignment="Center"
StyleClass="Primary"
Text="Text Value"
VerticalOptions="Center" />
如何在我的项目 App.Xaml 中覆盖 Primary StyleClass 以使文本颜色继承红色而不创建新的 styleclass?
【问题讨论】:
标签: xml xamarin xamarin.forms xamarin.android