Creating New Criteria Editors

Although there are plenty of inbuilt editors, there may not be one that looks, acts or exhibits functionality that meets your exact needs. For this reason the ability to create your own criteria value editors has been made available.

 

The process of making your own editor is relatively straight forward.  Because of the ease of implementing new editor types, you can provide your end users' with the best possible experience. For instance, if you have a number field but values are only ever within a certain range, you could have a slider control or a star rating system picker.

 

As previously mentioned, the editors are designed to be easy to implement and they provide you with two methods for implementation, an advanced method and a simple method, as well as the ability to create a popup editor with a minimum of fuss.

 

The Advanced Method

Inherit any control you want to turn into an editor for SQL Designer and implement the ICustomEditor Interface.

 

The Simple Method

Inherit from the GenericEditorBase user control, and override a few properties and methods.

 

Creating a Popup Editor

To create controls similar to the DateList, MultiSelectList and UserEntryList, you will need to inherit from the PopupFormBase form.

 

Adding A Datasource to the editor

The SQLDesigner supports supplying a list of data to the editors, like the SingleSelectList and MultiSelectList. There are two methods to do this, both discussed here.

 

How to activate your editor

Once you have created your editor you will need to either replace the inbuilt one or designate certain fields to use your custom editor.

 

In the sample application's source code, there is an implementation of a text box editor using the Advanced and Simple methods. The majority of the code to implement ICustomEditor is identical between controls so you can pick whichever model you prefer.