Loading...
Loading...
Comprehensive guide for implementing Syncfusion WPF IntegerTextBox control for integer value input with validation, formatting, and customization. Use this skill when implementing integer input controls, numeric validation for integers, or integer value entry in WPF. Covers integer data entry forms, min/max value restrictions, number formatting with culture support, integer value scrolling, range adorner progress visualization, and integer-specific input control implementation.
npx skill4agent add syncfusion/wpf-ui-components-skills syncfusion-wpf-integer-textboxSyncfusion.Shared.WPFSyncfusion.Windows.Shared<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
x:Class="IntegerTextBoxSample.MainWindow"
Title="IntegerTextBox Sample" Height="350" Width="525">
<StackPanel Margin="20">
<!-- Basic IntegerTextBox -->
<syncfusion:IntegerTextBox x:Name="integerTextBox"
Width="200"
Height="30"
Value="100"
MinValue="0"
MaxValue="1000"
VerticalAlignment="Center"/>
</StackPanel>
</Window>using Syncfusion.Windows.Shared;
using System.Windows;
namespace IntegerTextBoxSample
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
// Create IntegerTextBox
IntegerTextBox integerTextBox = new IntegerTextBox();
integerTextBox.Width = 200;
integerTextBox.Height = 30;
integerTextBox.Value = 100;
integerTextBox.MinValue = 0;
integerTextBox.MaxValue = 1000;
// Add to layout
this.Content = integerTextBox;
}
}
}<syncfusion:IntegerTextBox Value="{Binding Quantity, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
MinValue="1"
MaxValue="999"
Width="150"
Height="30"/>using System.ComponentModel;
using System.Runtime.CompilerServices;
public class ProductViewModel : INotifyPropertyChanged
{
private int quantity;
public int Quantity
{
get => quantity;
set
{
if (quantity != value)
{
quantity = value;
OnPropertyChanged();
// Trigger calculations or validation
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}<syncfusion:IntegerTextBox Value="123456789"
Culture="en-US"
GroupSeperatorEnabled="True"
NumberGroupSeparator=","
Width="200"
Height="30"/><syncfusion:IntegerTextBox Value="50"
MinValue="0"
MaxValue="100"
ScrollInterval="5"
ShowSpinButton="True"
IsScrollingOnCircle="True"
Width="150"
Height="30"/><syncfusion:IntegerTextBox Value="60"
MinValue="0"
MaxValue="100"
EnableRangeAdorner="True"
RangeAdornerBackground="LightBlue"
Width="200"
Height="30"/><syncfusion:IntegerTextBox Value="-50"
MinValue="-100"
MaxValue="100"
PositiveForeground="Green"
NegativeForeground="Red"
ApplyNegativeForeground="True"
ZeroColor="Gray"
ApplyZeroColor="True"
Width="150"
Height="30"/>| Property | Type | Default | Description |
|---|---|---|---|
| Value | int? | 0 | Current integer value of the control |
| MinValue | int | int.MinValue | Minimum allowed value |
| MaxValue | int | int.MaxValue | Maximum allowed value |
| ScrollInterval | int | 1 | Increment/decrement step value |
| ShowSpinButton | bool | false | Show up/down spinner buttons |
| EnableRangeAdorner | bool | false | Show progress bar-like visual |
| GroupSeperatorEnabled | bool | false | Enable number group separators |
| NumberGroupSeparator | string | Culture-based | Custom group separator character |
| Culture | CultureInfo | CurrentCulture | Culture for number formatting |
| UseNullOption | bool | false | Allow null values |
| NullValue | int? | null | Value to display when null |
| WatermarkText | string | string.Empty | Placeholder text when empty |
| PositiveForeground | Brush | Black | Foreground for positive values |
| NegativeForeground | Brush | Red | Foreground for negative values |
| ZeroColor | Brush | Green | Foreground for zero value |
| IsReadOnly | bool | false | Prevent user input |
| TextAlignment | TextAlignment | Left | Horizontal text alignment |
| CornerRadius | CornerRadius | 1 | Border corner rounding |
<StackPanel>
<TextBlock Text="Age:" Margin="0,0,0,5"/>
<syncfusion:IntegerTextBox Value="{Binding Age}"
MinValue="0"
MaxValue="150"
MinValidation="OnKeyPress"
MaxValidation="OnLostFocus"
Width="150"
Height="30"/>
</StackPanel><syncfusion:IntegerTextBox Value="{Binding OrderQuantity}"
MinValue="1"
MaxValue="999"
ScrollInterval="1"
ShowSpinButton="True"
Width="100"
Height="30"/><syncfusion:IntegerTextBox Value="{Binding TimeoutSeconds}"
MinValue="0"
MaxValue="3600"
EnableRangeAdorner="True"
RangeAdornerBackground="LightGreen"
WatermarkText="Enter timeout (seconds)"
Width="200"
Height="30"/><syncfusion:IntegerTextBox Value="{Binding Amount}"
Culture="en-US"
GroupSeperatorEnabled="True"
MinValue="0"
MinValidation="OnKeyPress"
Width="200"
Height="30"/><syncfusion:IntegerTextBox Value="{Binding CompletionPercentage}"
MinValue="0"
MaxValue="100"
EnableRangeAdorner="True"
RangeAdornerBackground="CornflowerBlue"
ScrollInterval="10"
IsScrollingOnCircle="True"
Width="250"
Height="30"/>TextValueText// ✅ CORRECT
integerTextBox.Value = 100;
// ❌ INCORRECT - Do not use
// integerTextBox.Text = "100";UseNullOptiontrueNullValueNullValueWatermarkTextNullValuegetting-started.md