How can change font size in UWP TimePikcerFlyout?

谁都会走 提交于 2019-12-11 15:17:07

问题


I want to make the font size of TimePickerFlyout bigger, It's Possible?


回答1:


The area that you pointed is LoopingSelector of TimerPicker. And the default font size is 15 in LoopingSelector style like the following.

<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="&#xE70E;"
                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="&#xE70D;"
                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>

If you want to make it more bigger. you just modify the following font size to another value. Then place complete style in <Application.Resources> in the App.xaml file.

<TextBlock Text="{Binding PrimaryText}" FontFamily="{ThemeResource ContentControlThemeFontFamily}" FontSize="15" />



来源:https://stackoverflow.com/questions/52380951/how-can-change-font-size-in-uwp-timepikcerflyout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!