Skip to content

syncfusion/wpf-ui-components-skills / skills/syncfusion-wpf-integer-textbox

syncfusion-wpf-integer-textbox

Verified

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.

references/validation-restrictions.md

View on GitHub
# Validation and Restrictions

## Overview

IntegerTextBox provides validation and restriction capabilities to ensure data integrity. Restrict values using `MinValue`/`MaxValue`, choose when validation occurs via `MinValidation`/`MaxValidation`, and control exceed behavior.

## Min/Max Value Restrictions

| Property | Default |
|----------|---------|
| `MinValue` | `long.MinValue` |
| `MaxValue` | `long.MaxValue` |

```xml
<syncfusion:IntegerTextBox Value="50" MinValue="0" MaxValue="100" Width="150" Height="30"/>
```

## Validation Modes

| Mode | Behavior |
|------|----------|
| `OnKeyPress` | Validates immediately on each keystroke |
| `OnLostFocus` | Validates when control loses focus (default) |

```xml
<syncfusion:IntegerTextBox MinValue="10" MaxValue="100" MinValidation="OnKeyPress" MaxValidation="OnLostFocus" Width="150" Height="30"/>
```

## Exceed Digit Behavior

Only applies when validation mode is `OnKeyPress`.

| Property | When `true` | When `false` |
|----------|-------------|--------------|
| `MaxValueOnExceedMaxDigit` | Resets to `MaxValue` | Retains last valid value |
| `MinValueOnExceedMinDigit` | Resets to `MinValue` | Retains last valid value |

```xml
<syncfusion:IntegerTextBox MinValue="10" MaxValue="100" MinValidation="OnKeyPress" MaxValidation="OnKeyPress" MinValueOnExceedMinDigit="True" MaxValueOnExceedMaxDigit="True" Width="150" Height="30"/>
```

## Read-Only Mode

| Property | Default | Purpose |
|----------|---------|---------|
| `IsReadOnly` | `false` | Disable user input |
| `IsReadOnlyCaretVisible` | `false` | Show cursor in read-only mode |

```xml
<syncfusion:IntegerTextBox Value="78" IsReadOnly="True" IsReadOnlyCaretVisible="True" Width="150" Height="30"/>
```

## Custom Value Validation

| Property | Description |
|----------|-------------|
| `ValidationValue` | Expected value string |
| `InvalidValueBehavior` | `None` / `DisplayErrorMessage` / `ResetValue` |

```xml
<syncfusion:IntegerTextBox InvalidValueBehavior="DisplayErrorMessage" ValidationValue="1234" Width="150" Height="30"/>
```

## ValueChanged Event Handler

```csharp
private void IntegerTextBox_ValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
    if (e.NewValue != null)
    {
        long value = (long)e.NewValue;
        // respond to value change
    }
}
```

## Best Practices

- Use `OnKeyPress` for critical fields (age, percentage) where invalid input must be prevented immediately.
- Use `OnLostFocus` when user experience flexibility is preferred.
- Combine with `EnableRangeAdorner="True"` for visual progress feedback.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 470kUpdated Claude CodeCodexUnverifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall