Why move
Existing Infragistics subscriptions can still be renewed, and Ultimate UI for Windows Forms is still being released. What changed is how you get a new license: a new developer on the team, or a new project, now needs a suite license, even when the application uses only a few Windows Forms controls. If those controls are masked and numeric fields, a tree, a multi-column dropdown, date fields and tabs, our five .NET controls cover them, sold separately or together. See moving from Infragistics Windows Forms for all five.
What you get
SftMask/NET 3.0 is a masked edit control for Windows Forms, written entirely in C# and shipped as a single assembly.
- One control for text and numbers. What UltraMaskedEdit, UltraNumericEditor and UltraCurrencyEditor do is one mask syntax in one control, so phone numbers, amounts and quantities are set up the same way.
- Numbers typed as on a calculator. Decimal, integer and hexadecimal fields with digit grouping, negative numbers, leading zeros and a range that is checked as the user types, read and set as a decimal?.
- Several numbers in one field. Each numeric field of a mask has its own range and its own spin buttons, as in the four parts of an IP address.
- A popup calculator that opens when an operator is typed into an amount, and autocomplete from earlier entries, files and folders.
- A label beside the input for the culture's currency symbol, a percent sign or a unit, which is not part of the contents.
- The details users notice. Password positions, undo, a default text, colors for invalid contents and for the focused field, and automatic advance to the next field or control.
- Familiar members. PromptChar, Culture, ValidatingType and TypeValidationCompleted are the members of the Windows Forms MaskedTextBox, and the property pages offer predefined masks and a field to try a mask at design time.
- Modern Windows. The same API and Visual Studio designer support in .NET Framework 4.7 (or later) and .NET 10 (or later) applications. Set one property and the control, its calculator and its autocomplete list follow the Windows light/dark setting. The control scales with the DPI of the monitor showing it, honors the Windows contrast themes and has built-in UI Automation support for Narrator, NVDA, JAWS and other screen readers.
A license is per developer and royalty-free, sold on its own.
Member mapping
SftMask/NET is not a drop-in replacement: its mask syntax is its own, there are no Appearance objects, and a numeric field's value is a nullable decimal instead of an object. This table shows where each UltraMaskedEdit member is found, with the numeric and currency editors' names where they differ.
| Task | UltraMaskedEdit | SftMask/NET 3.0 |
|---|---|---|
| Mask | InputMask (numeric and currency editors: MaskInput) | SftMask.Mask, in its own syntax (see translating masks) |
| Data type | EditAs; UltraNumericEditor: NumericType | The field tokens of the mask: $ for a decimal, $I for an integer, $X for a hexadecimal number |
| Value | Value (an object); UltraCurrencyEditor: Value (a decimal), ValueObject | SftMask.Value (decimal?, the first numeric field), SftMask.Values for several fields |
| Text | Text, GetText | SftMask.Text, SftMask.GetText, SftMask.TextWithLiterals, SftMask.TextNoLiterals |
| What Text returns | DataMode | SftMask.TextFormat (ExcludeLiterals, IncludeLiterals, IncludePrompt, IncludePromptAndLiterals) |
| Display without the focus | DisplayMode (numeric editors: MaskDisplayMode) | SftMask.ShowPromptNoFocus |
| Clipboard | ClipMode (numeric editors: MaskClipMode) | SftMask.ClipboardFormat, which also decides how pasted text is entered |
| Display format | FormatString | SftMask.FormattedText, built with SftMask.FormatCurrency or SftMask.FormatNumber; numeric fields show their grouping and decimals without it |
| Complete input | IsFullyInput, Sections, DisplayChars | SftMask.IsComplete, SftMask.IsFull, SftMask.IsEmpty, SftMask.IsValid, SftMask.Positions |
| Prompt | PromptChar, PadChar | SftMask.PromptChar, SftMask.PromptUnderline, SftMask.PromptUnderlineNoFocus |
| Empty value | Nullable | SftMask.AllowEmpty; Value is null whenever the field is empty |
| Range | MinValue, MaxValue | A range in each numeric field of the mask, such as (0,100); SftMask.IgnoreRangeWhileTyping |
| Spin buttons | SpinButtonDisplayStyle (numeric editors: SpinButtonAlignment) | SftMask.ButtonStyle (UpDown), SftMask.UpDownAlign, SftMask.SpinArrowKeys, for fields with the ^ token |
| Spin step | SpinIncrement | SftMask.SpinIncrement |
| Spin wrapping | SpinWrapBehavior | Fields wrap; the N token makes a field stop at its limits |
| Spin speed | SpinButtonIntervalSettings | SftMask.SpinAccelerations, which raise the step the longer a button is held |
| Rejected characters | InvalidChar | SftMask.InputRejected, also for pasted and assigned text, and SftMask.BeepOnError |
| Validation | MaskValidationError (numeric editors: ValidationError) | SftMask.ValidationError, SftMask.CustomValidation, SftMask.ValidateContents, SftMask.InvalidBackColor, SftMask.InvalidForeColor |
| Culture | CultureInfo (numeric editors: FormatProvider), {LOC} | SftMask.Culture, for the separators in numeric fields and the currency symbol, date separator and time separator tokens |
| Colors | Appearance, MaskLiteralsAppearance, PromptCharacterAppearance | SftMask.ForeColor, SftMask.BackColor, SftMask.TextAlign, SftMask.LiteralForeColor, SftMask.SelectionBackColor, SftMask.FocusBackColor |
| Borders and themes | BorderStyle, DisplayStyle, UseOsThemes | SftMask.BorderStyle, SftMask.BorderColor, SftMask.UseThemes |
| Insert and overtype | InsertMode, ToggleInsertMode | SftMask.InputMode, SftMask.Overtype |
| Tab key | TabNavigation (NextSection) | SftMask.TabAdvance, SftMask.TabAdvanceLast |
| Read-only | ReadOnly | SftMask.ReadOnly, SftMask.ReadOnlyUpDown |
| Events | ValueChanged (UltraCurrencyEditor: ValueObjectChanged), MaskChanged | SftMask.ValueChanged, SftMask.TextWithLiteralsChanged, SftMask.TextNoLiteralsChanged, SftMask.MaskChanged |
| Editor buttons | ButtonsRight, EditorButtonClick | SftMask.ButtonStyle (Ellipse) and SftMask.EllipseClick |
Translating masks
Many fixed-position masks carry over unchanged. Numeric masks are written as numeric fields, typed as on a calculator, where the decimal separator starts the fraction.
| Field | UltraMaskedEdit | SftMask/NET 3.0 |
|---|---|---|
| Phone number | (###) ###-#### | (###) ###-####, or \([M1-9]##\) ###\-#### so the area code cannot start with 0 |
| ZIP code | ##### | ##### |
| ZIP+4 code | #####-9999 | #####\-9999 |
| Social security number | ###-##-#### | ###\-##\-#### |
| Amount | {currency:6.2} | $,6.2 with Label "|" (the culture's currency symbol); $-,6.2 allows negative amounts |
| Percentage | nnn% with MinValue and MaxValue | $^3(0,100) with Label "%" and LabelPosition Right |
| Integer with a range | nnnn with MinValue and MaxValue | $I4(1,9999), or $I^N4(1,9999) with spin buttons that stop at the limits |
| IP address | nnn.nnn.nnn.nnn | $I^03(0,255)\.$I^03(0,255)\.$I^03(0,255)\.$I^03(0,255) with TabAdvance and AutoAdvance |
| Uppercase code | >AAA-AAAA | <uAAA\-AAAA> |
| Date or time | mm/dd/yyyy, {date}, {time} | A date field: SftDate/NET |
Watch for the placeholders that differ. In UltraMaskedEdit, ? is an optional letter; in SftMask/NET it is a required letter, and @ is the optional one. UltraMaskedEdit's C (any character, optional) is SftMask/NET's ~. Case conversion is written as a block: UltraMaskedEdit's > uppercases everything after it, while SftMask/NET opens an uppercase block with <u and closes it with >. And where UltraMaskedEdit maps . and , to the culture's separators anywhere in a mask, SftMask/NET does so inside numeric fields; elsewhere they are literals.
The same field in both
Both examples set up an amount with six digits before the decimal separator and two after it, the culture's currency symbol, a range and an empty value, and read the amount as a decimal. With UltraMaskedEdit:
ultraMaskedEdit1.InputMask = "{currency:6.2}";
ultraMaskedEdit1.Nullable = true;
ultraMaskedEdit1.MinValue = 0m;
ultraMaskedEdit1.MaxValue = 100000m;
object v = ultraMaskedEdit1.Value;
decimal? amount = (v == null || v is DBNull) ? (decimal?)null : Convert.ToDecimal(v);
With SftMask/NET, the range is part of the mask and the value is already a nullable decimal:
sftMask1.Mask = "$,6.2(0,100000)"; sftMask1.Label = "|"; sftMask1.TextAlign = HorizontalAlignment.Right; sftMask1.AllowEmpty = true; decimal? amount = sftMask1.Value;
Add ^ after the $ and set ButtonStyle to UpDown for spin buttons, or add C for the popup calculator. You can also skip the code: the property pages offer predefined masks and a field to try a mask at design time.
Migration notes
- Ranges are checked as the user types. A digit that would leave the range is rejected right away. Set IgnoreRangeWhileTyping to check only on validation, as UltraMaskedEdit does when the field is left.
- The value is typed. SftMask.Value is a decimal?, null when the field is empty, never DBNull. AllowEmpty decides whether an empty field is valid.
- Text includes the literals by default. SftMask.TextFormat starts as IncludeLiterals; set it to ExcludeLiterals where your code expects the raw input of UltraMaskedEdit's default DataMode.
- Keeping the focus is done in Validating. SftMask.ValidationError reports a Reason (incomplete, out of range, invalid or your own check); cancel the Validating event to keep the user in the field.
- Each field spins on its own. The spin buttons change the numeric field that holds the caret, within its range, and SpinAccelerations raise the step while a button is held.
Before you start
SftMask/NET masks hold text and numbers, not dates and times: fields with UltraMaskedEdit date or time masks move to SftDate/NET.
Try it
The free trial includes the working control and the C# and VB.NET samples. Replace one UltraMaskedEdit in your own forms before you buy. A license is per developer, royalty-free, and includes one year of support and upgrades.
Infragistics, UltraMaskedEdit, UltraNumericEditor and UltraCurrencyEditor are trademarks of Infragistics, Inc. Softel vdm is not affiliated with Infragistics.
