Siticone Currency Text Box
The SiticoneCurrencyTextBox is a specialized input control designed for financial applications.
It goes beyond simple text entry by enforcing numeric input, handling currency symbols and thousand separators automatically, and providing real-time validation for value ranges.
Currency Configuration
Configure the financial logic of the control to match local or international standards.
| Property | Type | Description & Usage Example |
|---|---|---|
CurrencySymbol |
string | txtAmount.CurrencySymbol = "$"; The symbol displayed alongside the value (e.g., $, €, £, ¥). |
CurrencySymbolPosition |
Enum | txtAmount.CurrencySymbolPosition = CurrencySymbolPosition.Right; Determines if the symbol appears to the Left or Right of the number. |
DecimalPlaces |
int | txtAmount.DecimalPlaces = 2; The number of digits to display after the decimal point. |
AllowNegative |
bool | txtAmount.AllowNegative = false; If true, allows entry of negative values. |
AllowCommaAsDecimalSeparator |
bool | txtAmount.AllowCommaAsDecimalSeparator = true; Essential for European formats (e.g., 1.234,56). Swaps the roles of comma and dot. |
InputType |
Enum | txtAmount.InputType = CurrencyAdvancedTextBoxInputType.Currency; Defines the underlying behavior model for input handling. |
Validation & Limits
Enforce business rules directly within the control by setting numeric boundaries.
| Property | Type | Description |
|---|---|---|
MinValue |
decimal | The lowest acceptable value. Validation fails if input is lower. |
MaxValue |
decimal | The highest acceptable value. Validation fails if input is higher. |
ValidationEnabled |
bool | Master switch to enable/disable Min/Max checks. |
ErrorColor |
Color | The text and border color applied when validation fails. |
IsValid |
bool | Read-only property indicating if the current value satisfies all rules. |
ValidationErrors |
ReadOnlyCollection | Gets the list of current validation error messages (e.g., "Value cannot be less than 10"). |
Data Access
Retrieve the input value in a type-safe manner.
| Property | Type | Description |
|---|---|---|
Value |
decimal | Returns the parsed numeric value of the input. Use this instead of parsing `Text` manually to avoid locale issues. |
TextContent |
string | Returns the formatted string visible to the user (e.g., "$1,234.56"). Updates to this property trigger formatting and validation automatically. |
CurrentState |
Enum |
Returns the current visual state: Idle, Hover, Focus, ReadOnly, or ValidationError.
|
Appearance & Styling
Customize the visual presentation to match your application's theme.
| Property | Type | Description |
|---|---|---|
CurrencyTextBoxType |
Enum |
Default: Standard 4-sided border.Material: Animated bottom-border only style.
|
CurrencyInputBorderColor |
Color | Border color in idle state. |
FocusCurrencyInputBorderColor |
Color | Border color when the control has focus. |
HoverCurrencyInputBorderColor |
Color | Border color on mouse hover. |
HoverOpacity |
float | Controls the border opacity when hovering (0.0 to 1.0). Default is 0.7 for a smooth effect. |
CornerRadius... |
int | Individual control for TopLeft, TopRight, BottomLeft, BottomRight radii. |
MakeRadial |
bool | Creates a pill-shaped input (fully rounded ends). |
CurrencyInputBackgroundColor |
Color | Sets the background color of the input area. |
Interaction Features
| Property | Type | Description |
|---|---|---|
ShowClearButton |
bool | Shows a clickable "X" icon inside the control when text is present and control is focused. |
ClearButtonSize |
int | Pixel size of the clear button "X". Default is 10. |
ClearButtonGap |
int | Space (in pixels) between the clear button and the text. Default is 6. |
PlaceholderText |
string | Text shown when the control is empty (e.g., "Enter amount"). |
PlaceholderFocusColor |
Color | Color of the placeholder text when the control is focused. Defaults to focus border color. |
IsReadOnly |
bool |
Locks the control.
Apply specific styling via CurrencyInputReadOnlyColors.
|
Programmatic Methods
Control the component logic from your code-behind.
| Method | Description |
|---|---|
| void Clear() | Clears the text content, resets validation state, and updates placeholder visibility. |
| bool ValidateInput() |
Forces the validation logic to run immediately. Returns true if valid, false if Min/Max rules are violated.
|
| void Focus() | Sets input focus to the internal text box, automatically handling the read-only state checks. |
| void RefreshPlaceholder() | Manually recalculates whether the placeholder text should be visible (useful after binding updates). |
Images & Icons
Add visual context with icons that can change based on the control's state.
| Property | Type | Description |
|---|---|---|
IdleImage |
Image | Icon shown by default. |
HoverImage |
Image | Icon shown on mouse hover. |
FocusImage |
Image | Icon shown when editing. |
ImageHoverOpacity |
float | Opacity level (0.1 - 0.9) used during image transitions. |
CurrencyInputImagePosition |
Enum | Left or Right alignment for the icon. |
Events
React to user actions, lifecycle changes, and validation results.
Key Events
// Fired when the user presses Enter while the control is focused.
// Provides access to the parsed value and validation state immediately.
txtAmount.EnterKeyPressed += (s, e) =>
{
// e is CurrencyInputEnterKeyEventArgs
if (e.IsValid)
{
// Safe to proceed with the transaction
ProcessPayment(e.Value);
}
else
{
MessageBox.Show("Invalid Amount: " + e.ValidationErrors[0]);
}
};
// Fired when the text changes.
txtAmount.TextContentChangedEnhanced += (s, e) =>
{
// Check the numeric value directly
if (txtAmount.Value > 1000)
{
lblStatus.Text = "High value transaction";
}
};
Lifecycle & State Events
| Event | Description |
|---|---|
ReadOnlyInteractionAttemptedEnhanced |
Fired when a user clicks or types in the control while IsReadOnly is true. Useful for showing "This field is locked" toast notifications. |
FocusStateChanged |
Fired when the control gains or loses focus. |
HoverStateChanged |
Fired when the mouse enters or leaves the control. |
ValidTextEnteredEnhanced |
Fired specifically when the user finishes entering text that passes all validation rules. |
ValidationChangedEnhanced |
Fired when the validity state (Valid vs Invalid) toggles. |
Designer Support
The SiticoneCurrencyTextBox offers extensive design-time support via Smart Tags.
| Category | Features |
|---|---|
Quick Currency Setup |
One-click configuration for major currencies:
|
Theme Presets |
Apply themes like Light, Dark, Corporate Blue, and Material Design instantly. |
Style Presets |
Toggle between Modern (Rounded), Flat (Sharp), and Material styles. |
Usage Examples
Example 1: Basic USD Input
Standard setup for dollar amounts.
private void SetupDollarInput()
{
txtPrice.CurrencySymbol = "$";
txtPrice.DecimalPlaces = 2;
txtPrice.CurrencySymbolPosition = CurrencySymbolPosition.Left;
txtPrice.PlaceholderText = "$0.00";
}
Example 2: European Format (Euro)
Configuring for regions that use commas as decimal separators.
private void SetupEuroInput()
{
txtEuro.CurrencySymbol = "€";
txtEuro.CurrencySymbolPosition = CurrencySymbolPosition.Right;
// Critical for "1.234,56" format
txtEuro.AllowCommaAsDecimalSeparator = true;
}
Example 3: Range Validation
Enforcing a price range for a product input.
private void SetupPriceLimits()
{
txtBid.ValidationEnabled = true;
txtBid.MinValue = 10.00m; // Minimum bid
txtBid.MaxValue = 500.00m; // Maximum buy-now price
txtBid.ErrorColor = Color.Red;
txtBid.ValidationChangedEnhanced += (s, e) =>
{
btnSubmitBid.Enabled = txtBid.IsValid;
};
}