I want to show a calendar with years only, not days nor months. Preferably with the DateEdit
that DevExpress provides.
You can accomplish this task by handling the DateEdit.Popup event:
private void dateEdit1_Popup(object sender, EventArgs e)
{
DateEdit edit = sender as DateEdit;
PopupDateEditForm form = (edit as IPopupControl).PopupWindow as PopupDateEditForm;
form.Calendar.View = DevExpress.XtraEditors.Controls.DateEditCalendarViewType.YearInfo;
}
more info here
Using PopupDateEditForm
will only format the view. But the user has to select the date at last.
Only showing and selecting Year can be achieve using this -
RepositoryItemDateEdit dropDownYear = new RepositoryItemDateEdit();
dropDownYear.Mask.EditMask = "yyyy";
dropDownYear.Mask.UseMaskAsDisplayFormat = true;
dropDownYear.VistaCalendarViewStyle = VistaCalendarViewStyle.YearsGroupView;
this.ColumnYear.ColumnEdit = dropDownYear;
Here I bind DateEdit
repo to GridCOlumn.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.