DatePropertyEditor. Getting Started

In this topic, you will learn how to use XafariDatePropertyEditor and ASPxXafariDateTimePropertyEditor. We will use an example from the Feature Center demo. We will assign the Property Editor to DateTimeSkipSeparatorProperty property of the DateTimeProperties type objects.  Follow the steps described below.

  • Open the existing XAF solution.
  • Add XafariModule and XafariEditorsModule to the Module Project.
  • Add XafariWebModule and XafariEditorsWebModule to the ASP.NET Web Module Project.
  • Add XafariWinModule and XafariEditorsWinModule to the Windows Forms Application Project.
  • Invoke the Model Editor. Navigate to the BOModel|Xafari.FeatureCenter.Editors|DateTimeProperties|OwnMembers|DateTimeSkipSeparatorProperty node. Set the PropertyEditorType property to "Xafari.Editors.Win.XafariDatePropertyEditor" (or "Xafari.Editors.Web.ASPxXafariDateTimePropertyEditor"), as shown in the figure below.

date_property_editor_5

  • Navigate to the Views|Xafari.FeatureCenter.Editors|DateTimeProperties_DetailView|Items|DateTimeSkipSeparatorProperty node and set the SkipSeparator property to True.

Note:

Be sure to check the EditMask property. The framework only processes the value of the SkipSeparator property correctly, if the Mask type is either None or DateTime. The setting of the EditMask is shown in the figure below.

date_property_editor_6

  • Application Model also exposes MaxWidth and MinWidth properties. It alows to set minimal and maximal width of editor. Default values is MinWidth = 250, MaxWidth = 260. The "-1" value means that the editor automatically adjusted to the size of View.

date_property_editor_7

  • To see the result, run the WinForms or ASP.NET application. Navigate to the DateTimeProperties_DetailView and click New Action. Pay attention to the behavior of the cursor when you enter the date using the keyboard.