migueldeicaza / MonoTouch.Dialog

Tools to simplify creating dialogs with the user using MonoTouch
MIT License
430 stars 211 forks source link

Added Optional Dates for DateElement, TimeElement, and DateTimeElement #186

Open eclipsed4utoo opened 11 years ago

eclipsed4utoo commented 11 years ago

Added ability for null dates in the DateElement, TimeElement, and DateTimeElement.

migueldeicaza commented 11 years ago

Hello,

Could you please describe how the feature is supposed to be used?

In general, I ask for documentation for new features in the docs/ directory, but I realize it can be cumbersome to setup our tooling, so at least we need docs on what the new behavior is, and what these properties do, and what effects it has on the code.

It should also come with tests demonstrating the feature

Miguel

eclipsed4utoo commented 11 years ago

With the current Date/Time/DateTime elements, we can't add it to a view and not give it a value. Sometimes, we just want to show the element without having to give it a date. For my company, we have optional DateTime fields that the user could or could not give us. We didn't want any date to show in the element unless the user chose one.

These changes allow for a developer to give NULL for the DateTime value(for the constructor) and the element won't display anything. The element changes the navigation bar to include a Cancel button on the right. Clicking Cancel allows the user to not choose a date. The Cancel button will be a Clear button if the element is clicked on and a value already exists for the element. This allows the user to clear an already set element value.

eclipsed4utoo commented 11 years ago

It also allows the developer to say whether the value is required or not. If the value is required, they can still give a NULL date, but the Cancel/Clear button won't show up. This forces the user to give a value, but doesn't force the developer to give a default value.