VWCMP
Current version: 1.0.18VWCMP is the small set of controls which can help you to create flexible UI with the smaller effort.
VWCMP contains:
- DateSelector - this control can be used to select date from the list;
- Keyboard – the on-screen keyboard which can serve as a hardware device analogue;
- ValidatableTextBox – the classic TextBox control with regular expression-based validation logic.
All types are defined inside the
Vodnev.Controls namespace.
DateSelector control (Date Picker)
DateSelector is the control which can be used to select date from the list.
Picture 1.1. DateSelector example application with all properties in their default values.DateSelector has several important members:
- SelectedDate – gets or sets visible date;
- MinimumYear – gets or sets minimum year in the list;
- MaximumYear – gets or sets maximum year in the list;
- ControlStyle – an enumeration, sets one of the predefined templates;
- LocaleName – gets or sets months names;
- SelectedDateChanged – an event raised when SelectedDate changes.
You can use one of predefined templates via ControlStyle property. Today only “Default”, “Touchscreen” and "TouchscreenYearOnly" templates are available, and you also can create your own. An example of custom template is included into the demo application (DateSelectorCustomTemplateDictionary.xaml).
If MinimumYear property value is greater than MaximumYear, last assigned value will be used for both MinimumYear and MaximumYear.
LocaleName gets and sets months names language. If no value is assigned, CultureInfo.CurrentCulture will be used.
Picture 1.2. DateSelector with ControlStyle.Touchscreen and LocaleName “it-IT”.
Picture 1.3. DateSelector with custom template applied.
Keyboard control
This control emulates hardware device buttons pressures.
It is possible to create almost any keyboard template. Control finds all buttons inside the template and uses ther
Tag property values.
Picture 2.1. Keyboard with ControlStyle.Default.Keyboard also has
KeyPressed event, which can be used to add additional functionality.
Picture 2.2. Keyboard with ControlStyle.TouchscreenNumbersOnly.
Picture 2.3. Keyboard with ControlStyle.LatinSimple.
Picture 2.4. Keyboard with custom template applied.
ValidatableTextBox control
This control uses regular expression to validate user input.
Every char typed (or erased) results in validating current text against
Regex type object. For sure, you will need some hands-on experience in using regular expressions.
Here are some examples:
- “^\d{5}$” – correct text must contain exactly five numbers;
- “^\d{4,}$” – correct text must contain four or more numbers.
- or you can refer to the Regular Expression Language Elements
Using
ValidationStateChanged event and
IsCorrect dependency property, you can notify user in any manner.
Picture 3.1. ValidatableTextBox validated as incorrect.
Picture 3.2. ValidatableTextBox validated as correct.
Picture 3.3. ValidatableTextBox with ControlStyle.Colored and ValidationRegex ‘^\(\d{3}\)-\d{3}-\d{4}$’.
Picture 3.4 ValidatableTextBox with the same parameters, as shown at the picture 3.3 and custom template applied.