How do I get DevExpress's Dateedit control to correctly display the date's week name

Source: Internet
Author: User
Tags date dateformat
express| Control | display
DevExpress's controls are pretty good and useful, but Dateedit can only display a "star" word when the week name is displayed.

Here's the workaround, which eliminates the need to modify its source code, so it's not necessary to recompile and use its published standard DLL directly.

public class MyDateEdit:DevExpress.XtraEditors.DateEdit
{
protected override DevExpress.XtraEditors.Popup.PopupBaseForm Createpopupform ()
{
Return to New Mypopupdateeditform (this);
}
}

public class MyPopupDateEditForm:DevExpress.XtraEditors.Popup.PopupDateEditForm
{
Public Mypopupdateeditform (Mydateedit dateedit): Base (Dateedit)
{
}

protected override DevExpress.XtraEditors.Controls.DateEditCalendar Createcalendar ()
{
return new Mydateeditcalendar (Owneredit.properties, Owneredit.editvalue);
}

}

public class MyDateEditCalendar:DevExpress.XtraEditors.Controls.DateEditCalendar
{
Public Mydateeditcalendar (
DevExpress.XtraEditors.Repository.RepositoryItemDateEdit Item,
Object editdate): Base (item, Editdate)
{
}

protected override DevExpress.XtraEditors.ViewInfo.DateEditInfoArgs Createinfoargs ()
{
DevExpress.XtraEditors.ViewInfo.DateEditInfoArgs info = base. Createinfoargs ();
System.Globalization.DateTimeFormatInfo Newformat =
(System.Globalization.DateTimeFormatInfo) Info. Dateformat.clone ();

The following is the week name of the reset date.
By default, the word "Week" is in front of you, and that's what makes a so-called error.
Note that the current implementation of the unhandled locale is only applicable to the Chinese environment.
Newformat.abbreviateddaynames = new string[]{
"Day",
"One",
"Two",
"Three",
"Four",
"Five",
"VI"};

Info. DateFormat = Newformat;

return info;
}

}

When you use it, just mydateedit dateEdit1 = new Mydateedit () is OK.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.