Infragistics(R) NetAdvantage(R) : WPF 2012.1
Using xamNumericInput
E-mail your feedback on this topic.
Shared XAML > Editors > xamInputs > xamNumericInput > Using xamNumericInput

Glossary Item Box

Purpose

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

Required background

You need to first read the following topics:

xamNumericInput Configuration Overview

Control configuration chart

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

Configurable behavior Configuration details Configuration properties
Adding xamNumericInput to an application Steps needed to add a xamNumericInput control to an application.

none

Modifying the xamNumericInput Configure some of the main properties of the control.

Mask

InvalidValueBehavior

ClipMode

NullText

PromptChar

SpinButtonDisplayMode

SpinIncrement

TrimFractionalZeros

Adding xamNumericInput to an application

Adding xamNumericInput to an application details

  1. Add the Infragistics namespace.
    1. Add the references needed.

      In order to add a xamNumericInput to your application you must add the InfragisticsWPF4.v12.1.dll InfragisticsWPF4.Controls.Editors.XamMaskedInput.v12.1.dll assemblies to your project.

    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; 
      
  2. Add a xamNumericInput control.

    In XAML:

    <ig:XamNumericInput/>
    

    In Visual Basic:

    Dim input As XamNumericInput = New XamNumericInput()
    

    In C#:

    XamNumericInput NumericInput = new XamNumericInput();
    

Modifying the xamNumericInput

Modifying the xamNumericInput property settings

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

In order to…

Use this property:

And set it to…

Set a mask

Mask

A string of your choosing

Revert the entered value, when it is invalid

InvalidValueBehavior

RevertValue

Let the user copy the contents of the control including all additional symbols

ClipMode

IncludeBoth

Display a specific string when the value is null

NullText

A string of your choosing

Display different prompt character than underscore

PromptChar

A character of your choosing

Display buttons for incrementing/decrementing the value

SpinButtonDisplayMode

Always/Focused/MouseOver

Change the increment value

SpinIncrement

A numeric value of your choosing

Set the input to keep fractional zeros that are in the end of the value

TrimFractionalZeros

False

Modifying the xamNumericInput 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:XamNumericInput Mask=”[Your Mask]”/>
    

    In Visual Basic:

    NumericInput.Mask = ”[Your Mask]”
    

    In C#:

    NumericInput.Mask = ”[Your Mask]”;
    

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

  2. Revert the entered value, when it is invalid.

    There are several options for how the xamNumericInput behaves when invalid value is entered by the user. If you set the InvalidValueBehavior property to RevertValue, every time the user enters an invalid value and leaves the input control, the new value is reverted to the original value.

  3. Let the user copy the contents of the control including all additional symbols.

    Setting the ClipMode property to IncludeBoth copies the input control’s contents to the clipboard including all prompt characters and mask literals.

  4. 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.

  5. Display different prompt character than underscore.

    The default prompt character used in the xamNumericInput is an underscore, but you can change this behavior by setting the PromptChar property to a character of your own choosing.

  6. Display buttons for incrementing/decrementing the value.

    If you want to display buttons for incrementing or decrementing the value of the xamNumericInput control you need to set the SpinButtonDisplayMode to Always, Focused, or MouseOver.

  7. Change the increment value.

    If you don’t specify the SpinIncrement property the default increment/decrement value used when the SpinButtons are clicked will be 1. However you may want it to be something else and you can do this by setting the desired value as the SpinIncrement.

  8. Set the input to keep fractional zeros that are in the end of the value.

    If you want zeros in the end of the fractional place of the xamNumericInput controls’s value to display you can set the TrimFractionalZeros property to False.

Modifying the xamNumericInput example

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

Property

Setting

Mask

{double:-5.3:c}

InvalidValueBehavior

RevertValue

ClipMode

IncludeBoth

NullText

Enter double

PromptChar

n

SpinButtonDisplayMode

Focused

SpinIncrement

0.01

TrimFractionalZeros

False

 

In edit mode:

In display mode:

Modifying the xamNumericInput property reference

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

Related Topics

Following are some other topics you may find useful.