Category / Section
How to localize month names in DateTimeEdit?
1 min read
DateTimeEdit allows to edit month names by AbbreviatedMonthNames Property. It will take this into account, if only 12 month names are added in collection of string.
The same has been explained in the following code snippet:
XAML:
//How to set Abbreviated Month names for DateTimeEdit <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:syncfusion="http://schemas.syncfusion.com/wpf" x:Class="DateTimeEdit1.MainWindow" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <x:Array Type="sys:String" x:Key="Months"> <sys:String>january</sys:String> <sys:String>Febrary</sys:String> <sys:String>march</sys:String> <sys:String>April</sys:String> <sys:String>May</sys:String> <sys:String>july</sys:String> <sys:String>june</sys:String> <sys:String>Auguest</sys:String> <sys:String>Septemper</sys:String> <sys:String>october</sys:String> <sys:String>November</sys:String> <sys:String>December</sys:String> </x:Array> </Window.Resources> <Grid> <syncfusion:DateTimeEdit Name="DateTimeEdit" Width="150" Height="80" AbbreviatedMonthNames="{StaticResource Months}" > </syncfusion:DateTimeEdit> </Grid> </Window>
C#:
//How to set Abbreviated Month names for DateTimeEdit namespace DateTimeEdit1 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); String[] Month={"Januaray","February","March","April","May","June", "July","Auguest","Septemper","October","Novermber","December"}; DateTimeEdit.AbbreviatedMonthNames = Month; } } }
Output: