Stupid week number!!!

4 posts, 0 answers
  1. Randy Hompesch
    Randy Hompesch avatar
    70 posts
    Member since:
    Nov 2008

    Posted 16 Nov 2016 Link to this post

    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>

  2. Nasko
    Admin
    Nasko avatar
    679 posts

    Posted 17 Nov 2016 Link to this post

    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.
  3. Randy Hompesch
    Randy Hompesch avatar
    70 posts
    Member since:
    Nov 2008

    Posted 17 Nov 2016 in reply to Nasko Link to this post

    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>

     

     

  4. Nasko
    Admin
    Nasko avatar
    679 posts

    Posted 18 Nov 2016 Link to this post

    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.
Back to Top