Hello,
Welcome to Microsoft Q&A!
Run in debug mode and comment and uncomment this line in App.xaml to see the TimePicker width change.
The problem is TimePickerThemeMinWidth
is StaticResource, it doesn't allow dynamic change. for updating Picker's Width, you could edit default style of TimePicker , find FlyoutButton
and delete this line MinWidth="{StaticResource TimePickerThemeMinWidth}"
. Then set Width property as normal.
Style
<Button
x:Name="FlyoutButton"
Grid.Row="1"
MaxWidth="{StaticResource TimePickerThemeMaxWidth}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
HorizontalContentAlignment="Stretch"
Background="{TemplateBinding Background}"
Foreground="{TemplateBinding Foreground}"
IsEnabled="{TemplateBinding IsEnabled}"
Style="{StaticResource TimePickerFlyoutButtonStyle}"
UseSystemFocusVisuals="{TemplateBinding UseSystemFocusVisuals}">
Usage
<TimePicker
Width="150"
HorizontalAlignment="Center"
ClockIdentifier="24HourClock" />
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.