Supported Data Types

YLOD comes in two flavors: the base library and an additional "Extras" project. The reason for this separation is to keep the total file size and number of dependencies required for your app as small as possible. While the base project only has a dependency on the Silverlight Toolkit for Windows Phone, the "Extras" project adds support for some more exotic data types like Color and additionally depends on the Coding4Fun Toolkit to provide editors for these. So, if you don't need these additional data types, you simply don't use the "Extras" project and therefore also don't need to pull the Coding4Fun library into your project dependencies.

Prerequisites

For a property to show up correctly in the options page, the following conditions must be met:
  • The property accessor must be public
  • The property must have a public getter
  • The property must have a public setter
  • The property must have one of the following types

Common Properties

All option configuration is done using attributes to decorate your option properties. Some of these configuration values are common to and shared across all supported data types, and hence are available for all attributes. In particular:

Property Type Description
DisplayName string The string that is displayed as name for an option, or a key to a resource file that can be used to lookup the localized value.
Description string The string that is displayed as description for an option, or a key to a resource file that can be used to lookup the localized value.
GroupName string A string that is used to group several options into one pivot item on the options page. The group name (or the localized value pulled from resourced using the group name value as key) is used as header for the pivot item.
DisplayOrder int An integer value used to sort the entries within a group.
ResourceType System.Type The type of the resource that should be used to look up localized resources. If no type is given, the values of properties like DisplayName, Description and GroupName are used directly; if a resource type is specified, the engine tries to look up the localized string in the resource, using the value of the mentioned properties as key.

Data Types in the Base Project

Attribte Property Type Description
OptionBooleanAttribute UserMustConfirmActivation bool True if the user must confirm activation of this option
UserMustConfirmDeactivation bool True if the user must confirm deactivation of this option
ActivationPrompt string The prompt text that is shown to the user when they must confirm activation, or the lookup key for the localized activation prompt text if a resource type is configured.
DeactivationPrompt string The prompt text that is shown to the user when they must confirm deactivation, or the lookup key for the localized activation prompt text if a resource type is configured.
OptionDateTimeAttribute Mode DateTimeMode Determines whether the UI only shows an editor for the date component, for the time component, or for both.
OptionEnumAttribute This attribute has no additional configuration parameters
OptionFloatAttribute Minimum double The minimum allowed value for this option. Default: double.MinValue
Maximum double The maximum allowed value for this option. Default: double.MaxValue
ValidationErrorMessage string The message that is displayed when the user fails to enter a valid floating point number, or if the value is outside the configured min/max bounds. If a resource type is configured, this is used as the key to look up a localized string.
OptionIntegralAttribute Minimum long The minimum allowed value for this option. Default: long.MinValue
Maximum long The maximum allowed value for this option. Default: long.MaxValue
ValidationErrorMessage string The message that is displayed when the user fails to enter a valid number, or if the value is outside the configured min/max bounds. If a resource type is configured, this is used as the key to look up a localized string.
OptionStringAttribute MinLength int The minimum allowed length for the string. Default: 0
MaxLength int The maximum allowed length of the string. Default: int.MaxValue
InputScopeNameValue InputScopeNameValue Defines the input scope of the SIP keyboard that should be used.
RegularExpression string A regex pattern that is used to validate the string input. Default: ^.*$
ValidationErrorMessage string The message that is displayed when the user fails to enter a valid string (min/max check, or matching the regular expression fails). If a resource type is configured, this is used as the key to look up a localized string.
ValidatorType Type This allows you to define a custom type that implements the IValidatorType interface to perform custom validator. As soon as such a type is defined, all other validation properties are ignored, in particular MinLength, MaxLength, RegularExpression and ValidationErrorMessage. For an example of a custom validator, please take a look at the included sample application in the source code.
OptionIgnoreAttribute This is a special attribute that signals to the engine that a particular property should be ignored. Properties decorated with this attribute will be skipped and do not show up in the options page.


Please note:
  • The OptionFloatAttribute is used for all kinds of floating point data types, in particular:
    • float
    • double
    • decimal
  • The OptionIntegralAttribute is used for all kinds of integral data types, in particular:
    • byte
    • sbyte
    • ushort
    • short
    • uint
    • int
    • ulong
    • long

Data Types in the Extras Project

Attribte Property Type Description
OptionColorAttribute This attribute has no additional configuration parameters
OptionTimeSpanAttribute Maximum string The maximum allowed time span. This must be provided as a string that can be parsed back into a time span value, for example in the format "hh:mm:ss"
Step string The step used by the time span picker control. This must be provided as a string that can be parsed back into a time span value, for example in the format "hh:mm:ss". Default: "00:00:01"

Last edited Nov 20, 2011 at 5:01 PM by Mister_Goodcat, version 3

Comments

No comments yet.