【发布时间】:2017-02-11 08:12:18
【问题描述】:
我创建了一个 Xamarin.Forms 应用程序,它有一个很长的名称。 当我在我的 4.5 英寸 Windows 10 手机上启动它时,它看起来很奇怪。
主页包含一个TabbedPage,它有Title 属性,但是它没有FontSize 属性。
我在我的 PCL 项目中使用以下 Style:
<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:
您可以从here下载示例项目。
【问题讨论】:
-
你能分享一个可以重现这个问题的基本演示吗?
-
@ElvisXia-MSFT 当然,它很容易重现。我添加了一个指向初始帖子的链接。
标签: xamarin.forms uwp xamarin.uwp