Version

We recommend that you use the xamMaskedEditor control instead of the xamMaskedInput control. The xamMaskedInput is being planned for retirement over the next few years and will not receive any new features. We will continue to provide support and critical bug fixes for the xamMaskedInput during this time. For help or questions on migrating your codebase to the xamMaskedEditor, please contact support.

Using xamMaskedInput

Topic Overview

Purpose

This topic demonstrates how to add a xamMaskedInput™ control to your application and use some of its more notable properties.

Required background

You need to first read the following topics:

xamMaskedInput Configuration Overview

Control configuration chart

The table below lists some of the configurable behaviors of the xamMaskedInput control.

Configurable behavior

Configuration details

Configuration properties

Steps needed to add a xamMaskedInput control to an application.

none

Configure some of the main properties of the control.

Adding xamMaskedInput to an application

  1. Add the Infragistics namespace.

    1. Add required references

      In order to add a xamMaskedInput control to your application you must add the following assemblies to your project:

      • InfragisticsWPF.Controls.Editors.XamMaskedInput.dll

      • InfragisticsWPF.dll

    2. Add the Infragistics namespace

      In XAML:

      xmlns:ig=http://schemas.infragistics.com/xaml

      In Visual Basic:

      Imports Infragistics.Controls.Editors

      In C#:

      using Infragistics.Controls.Editors;
  1. Add a xamMaskedInput control.

    In XAML:

    <ig:XamMaskedInput/>

    In Visual Basic:

    Dim maskedInput As XamMaskedInput = New XamMaskedInput()

    In C#:

    XamMaskedInput maskedInput = new XamMaskedInput();

Modifying the xamMaskedInput

The table below maps the desired configurations to property settings. The properties are directly accessed from the xamMaskedInput control.

Modifying the xamMaskedInput details

  1. Set a Mask.

    The most important part of setting up an input control is configuring the Mask property. Set a mask that suits your needs by:

    In XAML:

    <ig:XamMaskedInput Mask=”[Your Mask]”/>

    In Visual Basic:

    maskedInput.Mask = ”[Your Mask]”

    In C#:

    maskedInput.Mask = ”[Your Mask]”;

    For more information on how to create a mask, please refer to the Masks Topic.

  1. Keep an entered value even if it is not valid.

    There are several options for how the xamMaskedInput will behave when invalid value is entered by the user. If you set the InvalidValueBehavior property to RetainValue, then when the user enters an invalid value and tries to leave the input control, the value is retained.

  1. Let the user copy to the clipboard the mask literals and padding together with the value.

    By setting the ClipMode property to IncludeLiteralsWithPadding, when the user copies the input’s contents to the clipboard, the value is copied together with the mask literals and padding.

  1. Display a specific string when the value is null.

    When no value is entered in the control or when it is bound to a null value, you can set a string that is displayed. You can do this by setting the NullText property to the desired string. In this way you can guide the user on what to enter or to explicitly indicate that no value has been entered.

  1. Display different prompt character than underscore.

    The default prompt character used in the xamMaskedInput is underscore, but you can change this behavior by setting the PromptChar property to the desired character.

  1. Enable/disable undo/redo operations.

    By default, the xamInputs support undo/redo operations triggered by CTRL+Z and CTRL + Y keys combinations. If you want to disable this functionality, you can set the IsUndoEnabled property to False.

    Note
    Note

    Disabling the IsUndoEnabled property clears the undo/redo stack. If you disable undo/redo and then re-enable it, the commands won’t work because the undo/redo history is cleared.

Modifying the xamMaskedInput example

The images below demonstrate a xamMaskedInput control in edit and display mode as a result of the following settings:

Property

Setting

>aaaa (if set in XAML)

>aaaa (if set in procedural code)

RetainValue

IncludeLiteralsWithPadding

Enter code

~

In edit mode:

In display mode:

xamInputs xamMaskedInput Using 2.png
xamInputs xamMaskedInput Using 1.png

Modifying the xamMaskedInput property reference

For detailed information about these properties, refer to their listing in the property reference section: