Getting Started

This topic explains how to use Xafari Extra Filters. The main task is to assign PeriodStructPropertyEditor to DateTime property. Follow the steps described below.

  • Add XafariModule, XafariFiltersModule and XafariEditorsModule to Module Project.
  • Add XafariFiltersWindowsModule and XafariEditorsWinModule to Windows Forms Application Project.
  • Add XafariFiltersWebModule and XafariEditorsWebModule to Web Application Project.
  • Invoke the Model Editor. Navigate to the object item in the BOModel node. For example, image below demonstrates BOModel|Xafari.Northwind.Classifiers|Order node in the Xafari Northwind demo. Lookup list for PeriodFilterProperty contains all allowable properties for the selected object. Select required value from lookup list.

period_struct_property_editor_6

  • c#
  • VB

static class Program
{
  //...
  static void Main()
  {
    //...
    ExtraActionsWindowsFormsApplication winApplication = new ExtraActionsWindowsFormsApplication();
    //...
    winApplication.CreateCustomTemplate += winApplication_CreateCustomTemplate;
  }
  //...
  private static void winApplication_CreateCustomTemplate(object sender, CreateCustomTemplateEventArgs e)
  {
    if (e.Context == TemplateContext.ApplicationWindow)
      e.Template = new MainForm();
    else if (e.Context == TemplateContext.View)
      e.Template = new DetailViewForm();
  }
}

Friend Module Program
  '...
  Private Sub Main()
    '...
    Dim winApplication As ExtraActionsWindowsFormsApplication = New ExtraActionsWindowsFormsApplication()
    '...
    winApplication.CreateCustomTemplate += winApplication_CreateCustomTemplate
  End Sub
  '...
  Private Sub winApplication_CreateCustomTemplate(ByVal sender As Object, ByVal e As CreateCustomTemplateEventArgs)
    If e.Context = TemplateContext.ApplicationWindow Then
      e.Template = New MainForm()
    Else
      If e.Context = TemplateContext.View Then
        e.Template = New DetailViewForm()
      End If
    End If
  End Sub
End Module

  • To see the result, run the application and go to the List View for the corresponding objects.

Note also the following remarks:

  • ListView item in the Views node also contains PeriodFilterProperty. Its default value derives from the BOModel node for corresponding object.
  • PeriodStructPropertyEditor is a default Property Editor for Xafari.Base.PeriodStruct type.

You can download additional solution on this topic.

Important

There can be a situation when the period filter default value affects the new object initial value. This is possible if the List View uses CriteriaObjectCreation feature. If UseByListViewCriteriaObjectCreating property is set to "true", the filter values will be applied to new objects. Disable CriteriaObjectCreation to avoid this behavior.