Suggestion: show how to initialize TimePicker to the current time
Is this a totally new sample, an addition to an existing sample page, or a modification of an existing sample page?
- [ ] New sample
- [x] Addition to existing sample
- [ ] Modification to existing sample
If this is an addition/modification to an existing sample page, which one? TimePicker
Describe the sample
Show an example of how to initialize the TimePicker to the current time i XAML
Is your sample request related to a problem? Please describe it
Additional context
I don't think there is a way to do this purely in XAML as there isn't a "pure XAML" way to get the current time. Would you be interested in a way how to set this through a binding to a property from code behind?
CC: @kikisaints - any ideas?
Got this, so far.
<Page
x:Class="App2.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="using:System"
xmlns:local="using:App2"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TimePicker x:Name="myTimePicker" ClockIdentifier="24HourClock" Header="24 hour clock" SelectedTime="{x:Bind sys:DateTime.Now.TimeOfDay}"/>
</StackPanel>
</Page>
@stigAlgardstad That's awesome, would you be able to submit a PR with this sample?