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

Stupid week number!!!

3 Answers 236 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Randy Hompesch
Top achievements
Rank 1
Randy Hompesch asked on 16 Nov 2016, 05:15 PM

This is driving me crazy. I've seen numerous threads on this and none of the solutions seem to work for hiding the week number..

When I try to bring up the window shown below the dropdown calendar does not display at all. If I remove the InputMode="DatePicker" I can drop down the calendar but all I get is a list of times! No dates. What am I missing. Seems to me this having the week numbers not displaying should be the default. At the very least it should be an easily settable property instead of having to go through all these machinations.

Sorry, but this is very frustrating.

Ed

 

<Window x:Class="Calms2.Views.Test1"         
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"         
    xmlns:local="clr-namespace:Calms2"         
    Title="MainWindow" Height="350" Width="525" HorizontalAlignment="Left" >     
<Window.Resources>         
<Style x:Key="calendarStyle" TargetType="telerik:RadCalendar">             
    <Setter Property="AreWeekNumbersVisible" Value="False" />         
</Style>     
</Window.Resources>     

<StackPanel>         
    <telerik:RadDateTimePicker Width="500" HorizontalAlignment="Left"
                                     CalendarStyle="{StaticResource calendarStyle}"                                    
                                     InputMode="DatePicker"                                     
                                     VerticalAlignment="Center"/>     
</StackPanel>
</Window>

3 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 17 Nov 2016, 09:31 AM
Hello Randy,

The observed by you behavior is caused when Implicit Styles are used. For such scenarios the CalendarStyle you have created should be based on the default style of RadCalendar - thus everything should be visualized as expected:
<Style x:Key="calendarStyle" TargetType="telerik:RadCalendar" BasedOn="{StaticResource RadCalendarStyle}">
    <Setter Property="AreWeekNumbersVisible" Value="False" />
</Style>

Hope this helps.

Regards,
Nasko
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
0
Randy Hompesch
Top achievements
Rank 1
answered on 17 Nov 2016, 11:12 AM

Hi, thanks so much that finally got me off the dime.

However, I seem to be having trouble putting it at the application level in a resource dictionary. If I change the target type of the second style shown below to RadDateTimePicker I end up with the week numbers again. It's my understanding that putting the code below in a resource dictionary and then adding that dictionary to the Application.resources merged dictionaries should make it so that I don't have to explicitly add the CalendarStyle="{StaticResource calendarStyle}" to the instance of the RadDateTimePicker  How do I make it so that *ALL* RadDateTimePickers in my app do not show the week numbers? Do I have to explicitly apply the CalendarStyle="{StaticResource calendarStyle}"  to each instance in my xaml?

Thanks again ...  Ed

 

<Style x:Key="calendarStyle" TargetType="telerik:RadCalendar" BasedOn="{StaticResource RadCalendarStyle}">         <Setter Property="AreWeekNumbersVisible" Value="False" ></Setter>     
</Style>     
<Style TargetType="{x:Type telerik:RadDatePicker}" >         <Setter Property="CalendarStyle" Value="{StaticResource  calendarStyle}"></Setter>     
</Style>

 

 

0
Nasko
Telerik team
answered on 18 Nov 2016, 07:51 AM
Hello Ed,

Please, check the attached sample that demonstrates how to apply the desired CalendarStyle to all DateTimePickers in your application.

Hope this helps.

Regards,
Nasko
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Tags
DateTimePicker
Asked by
Randy Hompesch
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Randy Hompesch
Top achievements
Rank 1
Share this question
or