Software we are writing with WPF has some requirements to enter dates which are 10-20 years in the future. Ideally, we would like the FIRST popup to be the decade view, but which would then continue down to the month, then day - much like if you click on the header part several times. We don't want the control to ONLY take a year, so DateSelectionMode set to 'Year' is not what we want.
4 Answers, 1 is accepted
0
Hello Andrew,
Ventzi
Telerik
You could create a CalendarStyle in which you could set the DisplayMode property to CenturyView. Then you should apply the style when DropDownOpened event of the RadDateTimePicker occurs, because only then is the calendar part fully loaded.
I've attached a sample project which demonstrates this approach.
Ventzi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Andrew
Top achievements
Rank 1
answered on 29 Jul 2013, 02:37 PM
That's fantastic - just what I needed to point me in the right direction - in fact, I ultimately approached it slightly differently, with my own DatePicker class which subclasses yours. This way - I can default for all the date controls in my project, but can override in the XAML for those that we want to act normally.
Public Class MyDatePicker
Inherits Telerik.Windows.Controls.RadDatePicker
Private Sub MyDatePicker_DropDownOpened(sender As Object, e As RoutedEventArgs) Handles Me.DropDownOpened
Dim oStyle = New Style(GetType(RadCalendar))
oStyle.Setters.Add(New Setter(RadCalendar.DisplayModeProperty, Me.CalendarDisplayMode))
Me.CalendarStyle = oStyle
End Sub
Private _CalendarDisplayMode As Calendar.DisplayMode = Calendar.DisplayMode.DecadeView
Public Property CalendarDisplayMode() As Calendar.DisplayMode
Get
Return _CalendarDisplayMode
End Get
Set(value As Calendar.DisplayMode)
_CalendarDisplayMode = value
End Set
End Property
End Class
0
Andrew
Top achievements
Rank 1
answered on 13 Aug 2013, 12:53 PM
Actually - there is a problem with your and my approach - because the CalendarStyle can only be set once, before the Calendar popup is fully loaded. Once this has happened, and you've set a value, the subsequent popups are always at the Day level. Now, this SHOULD be the case when there is a selected date (the popup should be at that date), but if you clear the value in the control, the popup ideally would then go back to the Decade view. Is there any way to achieve this?
0
Hello Andrew,
I've updated the project to demonstrate how you could switch the DisplayMode when there is no SelectedValue in the DateTimePicker control.
I hope this solution will work in your scenario as well.
Regards,
Yana
Telerik
I've updated the project to demonstrate how you could switch the DisplayMode when there is no SelectedValue in the DateTimePicker control.
I hope this solution will work in your scenario as well.
Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>