如何更改 UWP TimePikcerFlyout 中的字体大小?
How can change font size in UWP TimePikcerFlyout?
我想把TimePickerFlyout的字体调大一点,可以吗?
您指向的区域是 TimerPicker
. And the default font size is 15 in LoopingSelector
样式的 LoopingSelector
,如下所示。
<Style TargetType="LoopingSelector">
<Setter Property="ShouldLoop" Value="True" />
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel VerticalAlignment="Center">
<TextBlock Text="{Binding PrimaryText}" FontFamily="{ThemeResource ContentControlThemeFontFamily}" FontSize="15" />
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="UpButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DownButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ScrollViewer x:Name="ScrollViewer"
VerticalSnapPointsType="Mandatory"
VerticalSnapPointsAlignment="Near"
VerticalScrollBarVisibility="Hidden"
HorizontalScrollMode="Disabled"
ZoomMode="Disabled"
Template="{StaticResource ScrollViewerScrollBarlessTemplate}" />
<RepeatButton x:Name="UpButton"
Content=""
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="8"
Height="22"
Padding="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Visibility="Collapsed"
Style="{StaticResource DateTimePickerFlyoutButtonStyle}"
Background="{ThemeResource LoopingSelectorButtonBackground}"
IsTabStop="False" />
<RepeatButton x:Name="DownButton"
Content=""
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="8"
Height="22"
Padding="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Visibility="Collapsed"
Style="{StaticResource DateTimePickerFlyoutButtonStyle}"
Background="{ThemeResource LoopingSelectorButtonBackground}"
IsTabStop="False" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
如果你想让它更大。您只需将以下字体大小修改为另一个值即可。然后将完整的样式放在 App.xaml 文件的 <Application.Resources>
中。
<TextBlock Text="{Binding PrimaryText}" FontFamily="{ThemeResource ContentControlThemeFontFamily}" FontSize="15" />
我想把TimePickerFlyout的字体调大一点,可以吗?
您指向的区域是 TimerPicker
. And the default font size is 15 in LoopingSelector
样式的 LoopingSelector
,如下所示。
<Style TargetType="LoopingSelector">
<Setter Property="ShouldLoop" Value="True" />
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel VerticalAlignment="Center">
<TextBlock Text="{Binding PrimaryText}" FontFamily="{ThemeResource ContentControlThemeFontFamily}" FontSize="15" />
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="UpButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DownButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ScrollViewer x:Name="ScrollViewer"
VerticalSnapPointsType="Mandatory"
VerticalSnapPointsAlignment="Near"
VerticalScrollBarVisibility="Hidden"
HorizontalScrollMode="Disabled"
ZoomMode="Disabled"
Template="{StaticResource ScrollViewerScrollBarlessTemplate}" />
<RepeatButton x:Name="UpButton"
Content=""
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="8"
Height="22"
Padding="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Visibility="Collapsed"
Style="{StaticResource DateTimePickerFlyoutButtonStyle}"
Background="{ThemeResource LoopingSelectorButtonBackground}"
IsTabStop="False" />
<RepeatButton x:Name="DownButton"
Content=""
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="8"
Height="22"
Padding="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Visibility="Collapsed"
Style="{StaticResource DateTimePickerFlyoutButtonStyle}"
Background="{ThemeResource LoopingSelectorButtonBackground}"
IsTabStop="False" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
如果你想让它更大。您只需将以下字体大小修改为另一个值即可。然后将完整的样式放在 App.xaml 文件的 <Application.Resources>
中。
<TextBlock Text="{Binding PrimaryText}" FontFamily="{ThemeResource ContentControlThemeFontFamily}" FontSize="15" />