我创建了一个 Xamarin.Forms 应用程序,它的名称很长。 当我在我的 4.5 英寸 Windows 10 手机上启动它时,它看起来很奇怪。
主页由 a 组成TabbedPage
,它具有Title
属性,但它没有FontSize
属性。
Style
我在我的 PCL 项目中使用以下内容:
<Style TargetType="Label">
<Setter Property="TextColor" Value="{StaticResource BaseColor}" />
<Setter Property="FontSize">
<Setter.Value>
<OnIdiom x:TypeArguments="x:Double"
Phone="18"
Tablet="28" />
</Setter.Value>
</Setter>
</Style>
但是,如果我删除它,标题仍然很大。
我在哪里可以修改标题字体大小以使标题更小?
更新:
我检查了实时属性编辑器,它显示在Title
里面CommandBar
并且FontSize
设置为 24。
我试图覆盖它的样式(在 XAML 和代码中),但它不起作用:
<forms:WindowsPage.BottomAppBar>
<CommandBar>
<CommandBar.Style>
<Style TargetType="CommandBar">
<Setter Property="FontSize" Value="4" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<TextBlock Text="Whatever" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</CommandBar.Style>
<CommandBar.Content>
<TextBlock Text="Whatever" />
</CommandBar.Content>
</CommandBar>
</forms:WindowsPage.BottomAppBar>
public MainPage()
{
this.InitializeComponent();
var bapp = BottomAppBar;
LoadApplication(new MyXamarinApp.App(IoC.Get<SimpleContainer>()));
BottomAppBar = bapp;
BottomAppBar.FontSize = 4;
}
任何想法?
更新 2:
您可以从这里下载示例项目。