This is a migrated thread and some comments may be shown as answers.

Open At Current Time

4 Answers 66 Views
TimePicker
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Veteran
Anthony asked on 07 Apr 2021, 08:05 AM

Hi,

When the user opens the picker for the first time, is there any way to have it default to the current time?

I know I can set DefaultHighlightedTime but the user may spend some minutes in the screen before they select a time so the DefaultHighlightedTime is no longer the current time and is a few minutes ago.

Regards

Anthony

4 Answers, 1 is accepted

Sort by
0
Accepted
Didi
Telerik team
answered on 08 Apr 2021, 11:48 AM

Hello Anthony,

You can achieve this using DateTimePicker in Time picker mode and bind the DefaultHighlightedDate to a property inside the ViewModel which returns DateTime.Now. When you press cancel and open the picker again the defaulthighlight date will be changed to the current DateTime.

I have created a sample to show you how this could be achieved. Download the file and test on your side.

I hope the provided information was helpful. 

Regards,
Didi
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Anthony
Top achievements
Rank 1
Veteran
answered on 08 Apr 2021, 11:32 PM

Hi,

Thanks, that does work however the placeholder text now looks very different because of the new ControlTemplate. Do you have the default values for this so I can set them to match other controls?

Regards

Anthony

0
Accepted
Didi
Telerik team
answered on 09 Apr 2021, 09:26 AM

Hello Anthony,

This is the default placeholder template:

<ControlTemplate x:Key="Picker_PlaceholderView_ControlTemplate">
    <Grid>
        <Grid.GestureRecognizers>
            <TapGestureRecognizer Command="{TemplateBinding ToggleCommand}" />
        </Grid.GestureRecognizers>
        <Label Text="{TemplateBinding Placeholder}"
               Style="{TemplateBinding PlaceholderLabelStyle}"
               AutomationId="PickerPlaceholderLabel"/>
    </Grid>
</ControlTemplate>

Regards,
Didi
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Anthony
Top achievements
Rank 1
Veteran
answered on 11 Apr 2021, 10:05 PM

Hi,

Thanks for that.

Regards

Anthony

Tags
TimePicker
Asked by
Anthony
Top achievements
Rank 1
Veteran
Answers by
Didi
Telerik team
Anthony
Top achievements
Rank 1
Veteran
Share this question
or