The far more simpler way for creating most editors is to inherit from the Connect4.SQLDesigner.WinUI.Editors.GenericEditorBase which is a user control with the interface fully implemented.
All you need to do to create an editor via this method is to inherit the GenericEditorBase and override one or two properties depending on what kind of editor you wish to create.
If you wish to create a list editor (that is an editor that provides values for SQL syntax like IN) then you will need to override the ValueArray property. In set part of the property you will receive a string array with the values that are already held by the condition object. In the get part of the property you will have to return an array of values.
If you only deal with one value at a time then override the Value property and have it set/return the value as a string.
Note: If you do not override the ValueArray property and the editor is used in list mode or if you don't override the Value property and it is used in a single entry mode then a NotSupportedException will be thrown.
Validation
Validation is taken care of automatically by the base editor, however if you want to perform more complex validation then you can override the DoValidation method returning true if successful, see below for more information about overriding DoValidation.
For list editors
If the array you return is in anyway different to the one that supplied to start with (including number and order of elements) then all the elements in the array will be validated and then assigned to the condition object if it is valid.
For single values
If the value is different in anyway then it will run through the validation and be assigned to the condition object if it is valid.
Overriding DoValidation
If you chose to override DoValidation then there are a few things you will need to take into account.
Check to see if you are in single or list mode, you can do this by checking ConditionIndex, if it is -1 then it is in list mode.
Unless it causes problems for your implementation you should always call the SQLDesigner.Engine.Common.Validate method first as it will perform the case check and checks the value against the field datatype, you should also be prepared for the value you pass into the validate function to be changed (the value parameter is by reference not by value), so you may need to update the internal value to reflect the change.
If validation succeeds you will have to set the Condition.ConditionValue(ConditionIndex) = value for single mode or Condition.ConditionValues = ValueArray for list mode
If validation fails call OnValidationError with
the applicable error message (the SQLDesigner.Engine.Common.Validate method
returns a ValidationResult structure, which has an ErrorMessage property
which if the validation failed provides a reason that you can pass to
the OnValidationError