<ui:Page
    x:Class="MahAppsSample.ControlPages.SimpleTimePickerPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:sc="clr-namespace:SamplesCommon;assembly=SamplesCommon"
    xmlns:ui="http://schemas.modernwpf.com/2019"
    xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
    mc:Ignorable="d">

    <ScrollViewer>
        <ui:SimpleStackPanel
            x:Name="ContentPanel"
            Style="{StaticResource ControlPageContentPanelStyle}">
            <sc:ControlExample HeaderText="A simple TimePicker.">
                <ui:SimpleTimePicker />
                <sc:ControlExample.Options>
                    <ui:SimpleStackPanel Style="{StaticResource OptionsPanelStyle}">
                        <sc:LayoutDensitySelector TargetElement="{Binding ElementName=ContentPanel}" />
                    </ui:SimpleStackPanel>
                </sc:ControlExample.Options>
            </sc:ControlExample>
            <sc:ControlExample HeaderText="A TimePicker with a header and minute increments specified.">
                <ui:SimpleTimePicker
                    Header="Arrival time"
                    SourceMinutes="{x:Static mah:TimePicker.IntervalOf15}" />
            </sc:ControlExample>
            <sc:ControlExample HeaderText="A TimePicker using a 24-hour clock.">
                <ui:SimpleTimePicker
                    Header="24 hour clock"
                    Culture="zh-CN" />
            </sc:ControlExample>
            <sc:ControlExample HeaderText="API in action">
                <ui:SimpleTimePicker
                    x:Name="TimePicker"
                    SelectedDateTimeChanged="TimePicker_SelectedDateTimeChanged" />
                <sc:ControlExample.Options>
                    <ui:SimpleStackPanel Style="{StaticResource OptionsPanelStyle}">
                        <ComboBox
                            ui:ControlHelper.Header="PickerVisibility"
                            ItemsSource="{Binding Source={x:Type mah:TimePartVisibility}, Converter={StaticResource EnumValuesConverter}}"
                            SelectedItem="{Binding ElementName=TimePicker, Path=PickerVisibility}" />
                        <TextBox
                            ui:ControlHelper.Header="HourPlaceholderText"
                            Text="{Binding ElementName=TimePicker, Path=HourPlaceholderText, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBox
                            ui:ControlHelper.Header="MinutePlaceholderText"
                            Text="{Binding ElementName=TimePicker, Path=MinutePlaceholderText, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBox
                            ui:ControlHelper.Header="SecondPlaceholderText"
                            Text="{Binding ElementName=TimePicker, Path=SecondPlaceholderText, UpdateSourceTrigger=PropertyChanged}" />
                        <Button
                            Content="Set value to now"
                            Click="SetValueToNow_Click" />
                        <Button
                            Content="Clear value"
                            Click="ClearValue_Click" />
                    </ui:SimpleStackPanel>
                </sc:ControlExample.Options>
            </sc:ControlExample>
        </ui:SimpleStackPanel>
    </ScrollViewer>
</ui:Page>
