Loading...
Loading...
Compare original and translation side by side
Syncfusion.Shared.WPFSyncfusion.Windows.SharedSyncfusion.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><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;
}
}
}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="{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="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="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="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"/><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 |
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| Value | int? | 0 | 控件的当前整数值 |
| MinValue | int | int.MinValue | 允许的最小值 |
| MaxValue | int | int.MaxValue | 允许的最大值 |
| ScrollInterval | int | 1 | 增减数值的步长 |
| ShowSpinButton | bool | false | 显示上下微调按钮 |
| EnableRangeAdorner | bool | false | 显示类似进度条的视觉效果 |
| GroupSeperatorEnabled | bool | false | 启用数字组分隔符 |
| NumberGroupSeparator | string | 基于区域性 | 自定义组分隔符字符 |
| Culture | CultureInfo | CurrentCulture | 用于数字格式化的区域性 |
| UseNullOption | bool | false | 允许空值 |
| NullValue | int? | null | 空值时显示的数值 |
| WatermarkText | string | string.Empty | 空状态下的占位符文本 |
| PositiveForeground | Brush | Black | 正值的前景色 |
| NegativeForeground | Brush | Red | 负值的前景色 |
| ZeroColor | Brush | Green | 零值的前景色 |
| IsReadOnly | bool | false | 禁止用户输入 |
| TextAlignment | TextAlignment | Left | 文本水平对齐方式 |
| CornerRadius | CornerRadius | 1 | 边框圆角半径 |
<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><StackPanel>
<TextBlock Text="年龄:" 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 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 TimeoutSeconds}"
MinValue="0"
MaxValue="3600"
EnableRangeAdorner="True"
RangeAdornerBackground="LightGreen"
WatermarkText="输入超时时间(秒)"
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 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"/><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";TextValueText// ✅ 正确用法
integerTextBox.Value = 100;
// ❌ 错误用法 - 请勿使用
// integerTextBox.Text = "100";UseNullOptiontrueNullValueNullValueWatermarkTextNullValueUseNullOptiontrueNullValueNullValueWatermarkTextNullValuegetting-started.mdgetting-started.md