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

How to not have the year on a DatePicker

1 Answer 26 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Siham
Top achievements
Rank 1
Siham asked on 18 Mar 2019, 08:31 AM

Hi All,

I am now trying to have a DatePicker without the year on the TextBlock (only day and month).

I've tried to use StringFormat by puting it on 'dd/MMMM' but it doesn't work.

my code is the following:

<telerik1:RadDatePicker Width="150" x:Name="DatePickerRevision" SelectedDate="{helpers:CultureAwareBinding Model.BauxInfo.DateDerniereRevision,     Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, StringFormat='dd/MMMM'}" IsTabStop="True"     
    ErrorTooltipContent="{helpers:CultureAwareBinding ValidationMetier,Converter=     {converters1:ErreurValidationMetierConverter},ConverterParameter=DateDerniereRevision}" 
    DisplayDate="{helpers:CultureAwareBinding DateClick}" String>
              <telerik1:RadDateTimePicker.CalendarStyle>
                    <Style TargetType="telerik1:RadCalendar" BasedOn="{StaticResource {x:Type telerik1:RadCalendar}}" >
                           <Setter Property="MonthViewHeaderFormat" Value="MMMM" />
                           <Setter Property="AreWeekNumbersVisible" Value="False"/>
                    </Style>
              </telerik1:RadDateTimePicker.CalendarStyle>
</telerik1:RadDatePicker>

 

Please help, is there anything in my code that doesn't let the TextBlock taking the format I need?

thank you

1 Answer, 1 is accepted

Sort by
0
Dinko
Telerik team
answered on 20 Mar 2019, 03:09 PM
Hello Siham,

Thank you for the attached image.

I would suggest you to take a look at the Defining a custom format section in the Formatting help article in our documentation. This section describes how you can apply custom format to the control. In your case will be: 
this.DatePickerRevision.Culture = new System.Globalization.CultureInfo("en-US");
this.DatePickerRevision.Culture.DateTimeFormat.ShortDatePattern = "dd/MMMM";

Give this approach a try and let me know if it works for you.

Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
DatePicker
Asked by
Siham
Top achievements
Rank 1
Answers by
Dinko
Telerik team
Share this question
or