How to create a Custom Class for XamNumericEditor for Decimal Input in WPF – Infragistic

Here I guide you, how you can create your own custom control. I am creating a custom textbox for decimal input by inherenting my class from XamNumericEditor.

Step 1: Create a New Class and inherit it from XamNumericEditor.

using Infragistics.Controls.Editors;  // add dll reference for using it
public namespace CustomControl
{
public class CustomNumericTxtbox : XamNumericEditor
    {
        public CustomNumericTxtbox()
        {
        }
    }
}

Step 2: Create a style in Resource Dictionary with Mask Property for Decimal Value

xmlns:ctrl="clr-namespace:CustomControl"
 
<Style TargetType="{x:Type ctrl:CustomNumericTxtbox}">
        <Setter Property="Mask" Value ="{}{double:4.2}"/>
</Style>

Step 3 : Use that Custom Class as a control in your project wherever needed.

xmlns:igDP="http://infragistics.com/DataPresenter"
xmlns:igED="http://infragistics.com/Editors"
<igDP:TemplateField Name="WeightProperty" Label="WeightColumn" Width="200"> 
	<igDP:Field.Settings>
		<igDP:FieldSettings  EditorType="{x:Type ctrl:CustomNumericTxtbox}" > 
		</igDP:FieldSettings>
	</igDP:Field.Settings>
</igDP:TemplateField>