Add a new bindable property “NullableValue” looks like the best solution, as it doesn’t compromise the core functionality and supports the null concept. While we are talking about “bindable” properties, I’d like to see components, like MenuItem etc. to implement IBindableComponent, i.e. to be “bindable”.
OK, thanks. But if we change DateTime to DateTime? and Decimal to Decimal? it must be done early one. It’s not something we can change after the release. Another option would be to add a new bindable property “NullableValue”.
I have done exactly that in my custom DateTimePicker UserControl, i.e. I have it return a DateTime? value and binding works correctly. But I wouldn’t like to test an experimental build now, I think we should keep playing with one bet product at the moment and not “deviate” to different versions.
However, I don’t see why not make your controls return nullable types if this is possible. What is the opinion of other beta testers?
The problem with null dates and numbers is that Microsoft left them out when they designed .NET from the start. DateTime and Decimal don’t have an IsNull property and cannot be null. In addition, ADO.NET expects and returns DBNull.Value when the db field is null.
We have a similar issue in our other .NET framework and we added IsNull and UseMinValueAsNull and we have an IDbValue interface for binding on our custom types. However those solutions cannot be applied to Wisej.
We could change the Value type of DateTimePicker and NumericUpDown to DateTime? and Decimal? nullable types. That would allow the control to return null when empty. I’m not sure how a database bound data source would react, need to test this.
Would you like to receive an experimental build with DateTime? and Decimal? Value properties in DateTimePicker and NumericUpDown and give it a try on your end?
Thanks for your answers.
The null value support and more is already implemented:
In addition, very soon we will add the Toolbox component to all editable controls and you’ll be able to add custom icons/buttons. See the title of the window in this small demo: http://demo.wisej.com/apps/datepicker.html
Panels, windows, and soon all editables, can have any number of custom tools.
To answer the other questions:
Also a +1 from our site for this feature! We implemented a similar custom user control in VWG for this feature. Basically it was a DateTimePicker with a checkbox, through which the selected value could be cleared and set to null.