我正在尝试通过App.xml全局设置特定样式 但是该样式未应用于页面
这是我的App.xml
include
这是我的LoginPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WTF.Framework.Applications.CrossPlatform.App">
<Application.Resources>
<ResourceDictionary>
<ControlTemplate x:Key="Template">
<StackLayout>
<Label Text="Control Template Demo App" TextColor="black" />
<ContentPresenter />
<BoxView Color="Teal"/>
<Label Text="(c) WTF 2018" TextColor="Blue" VerticalOptions="Center"/>
</StackLayout>
</ControlTemplate>
<!--Below is how to set individual properties of components-->
<Style x:Key="FieldLabelStyle" TargetType="Label">
<Setter Property="TextColor" Value="#77787A" />
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalOptions" Value="StartAndExpand" />
<Setter Property="VerticalOptions" Value="FillAndExpand" />
<Setter Property="FontAttributes" Value="Bold" />
<Setter Property="VerticalTextAlignment" Value="Center" />
<Setter Property="LineBreakMode" Value="TailTruncation" />
<Setter Property="BackgroundColor" Value="Transparent" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
如您所见,我正在尝试将用户名标签更改为特定样式,并将整个页面更改为使用控件模板。但是在运行时,该应用似乎丢弃了模板。是因为App.xaml位于同一解决方案中的另一个项目中吗?