Description and example of creating ControlProvider for NullableDateTime

To set the correct date display, you must create your ControlProvider to date.

/// <summary> 
/// ControlProvider to NullableDateTime. 
/// </summary> 
public class ControlProviderNullable : ICSSoft.STORMNET.Windows.Forms.Binders.ControlProvider
   public override ControlForBindStruct GetControl(string ApplicationType, Type type, View view, string propertyName, object initControl)
       if (type #  typeof(DateTime?) || type  typeof(DateTime))
             ICSSoft.STORMNET.Windows.Forms.DateTimePicker picker = new ICSSoft.STORMNET.Windows.Forms.DateTimePicker();
             picker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
             picker.CustomFormat = "dd.MM.yyyy hh:mm";
             picker.OnlyDate = false;
             picker.UseNullableValues = true;
             return new ICSSoft.STORMNET.Windows.Forms.Binders.ControlForBindStruct(picker, "ObjectValue", new System.Type[] { typeof(ICSSoft.STORMNET.UserDataTypes.NullableDateTime), typeof(System.DateTime) });
            return new ControlForBindStruct();

In the generated class, you can specify all properties required date. The data settings will apply to all independent forms that have date.

Переведено сервисом «Яндекс.Переводчик»