0

I want to show a calendar with years only, not days nor months. Preferably with the DateEdit that DevExpress provides.

1
  • Thanks for editing Muhammad Omar.
    – PoteKing
    May 24, 2016 at 16:37

2 Answers 2

1

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

1
  • I want to add that this solution is just for the users of DevExpress 15.2 and above.
    – PoteKing
    May 25, 2016 at 9:59
0

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.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.