Siticone Logo
Siticone UI
DOCS
v2025.12.15
Docs Material Textbox

Siticone Material Textbox

The SiticoneMaterialTextbox is a modern, high-performance input control that implements Material Design principles. It features an animated focus underline, comprehensive validation support, drop shadows, and a floating placeholder system that transitions smoothly as the user types.

Visuals & Styling

Customize the core appearance, including borders, background fills, and gradients.

Property Type Description & Usage Example
SolidFillColor Color txt.SolidFillColor = Color.White; The primary background color of the textbox.
SolidBorderColor Color txt.SolidBorderColor = Color.LightSlateGray; The color of the bottom border in the idle state.
SolidBorderFocusColor Color txt.SolidBorderFocusColor = Color.DodgerBlue; The color of the animated underline when the control has focus.
ShowBorder bool txt.ShowBorder = false; If false, hides the bottom border entirely, useful for minimal UI designs.
UnderlineAnimationSpeed float txt.UnderlineAnimationSpeed = 0.15f; Controls how fast the focus line expands. Values between 0.0 and 1.0.
UseBorderGradient bool txt.UseBorderGradient = true; Enables a gradient on the border line instead of a solid color.

Text & Placeholder

Manage input text, placeholder animations, and text transformations.

Property Type Description & Usage Example
Text string txt.Text = "Hello World";
PlaceholderText string txt.PlaceholderText = "Enter Username"; Text displayed when the field is empty. It fades out automatically when typing begins.
PlaceholderColor Color txt.PlaceholderColor = Color.Gray;
TextAlign TextAlignment txt.TextAlign = TextAlignment.Center;
TextCaseMode TextCase txt.TextCaseMode = TextCase.Upper; Automatically transforms input to Upper, Lower, or keeps it Normal.
MaxLength int txt.MaxLength = 50; Limits the number of characters that can be entered.

Validation System

Built-in tools to enforce required fields and custom validation logic with visual feedback.

Property Type Description & Usage Example
IsRequired bool txt.IsRequired = true; If true, marks the field as mandatory. Displays an asterisk (*) and triggers error states if left empty upon losing focus.
IsRequiredErrorColor Color txt.IsRequiredErrorColor = Color.Red; The color of the border and error icon when validation fails.
ValidationFunction Func<string,bool> txt.ValidationFunction = (text) => text.Contains("@"); Assign a lambda expression or method to perform custom validation. Returns true if valid, false otherwise.
ValidationErrorMessage string txt.ValidationErrorMessage = "Invalid Email"; The message stored in the ErrorMessage property when ValidationFunction returns false.
IsValid bool if (txt.IsValid) { ... } Read-only property indicating the current validation status.

Shadows & Effects

Advanced visual effects including drop shadows and attention-grabbing blinking animations.

Property Type Description & Usage Example
EnableDropShadow bool txt.EnableDropShadow = true; Draws a soft shadow below the control, adding depth.
ShadowColor Color txt.ShadowColor = Color.FromArgb(20, Color.Black);
ShadowBlur int txt.ShadowBlur = 10;
BlinkShadow bool txt.BlinkShadow = true; Triggers a blinking animation on the shadow. Useful for drawing attention to specific fields (e.g., during a tutorial or error).
BlinkCount int txt.BlinkCount = 3; The number of times the shadow blinks before stopping (if ContinuousBlink is false).

Behavior & Security

Property Type Description & Usage Example
IsReadOnly bool txt.IsReadOnly = true; Prevents text editing. Triggers Shake or Beep effects if user attempts to type (see CanShake).
UseSystemPasswordChar bool txt.UseSystemPasswordChar = true; Masks input characters for sensitive data entry.
PasswordChar char txt.PasswordChar = '●';
CanShake bool txt.CanShake = true; If true, the control shakes horizontally when a user attempts to edit a ReadOnly field or when validation fails on focus loss.
AutoCompleteMode AutoCompleteMode txt.AutoCompleteMode = AutoCompleteMode.Suggest; Enables the custom suggestion dropdown list.
TrackSystemTheme bool txt.TrackSystemTheme = true; Automatically adjusts colors based on the Windows Light/Dark theme settings.

Events

Advanced event handling for user interactions and data processing.

EnterKeyPressed Event (Comprehensive Data)
// Occurs when the user presses the 'Enter' key while the control has focus.
// The event args provide instant access to validation state and text data
// without needing to query the control instance properties.
siticoneTextbox1.EnterKeyPressed += (sender, e) => 
{
                // 1. Check if the input is valid based on IsRequired or ValidationFunction
                if (!e.IsValid)
    {
                MessageBox.Show($"Validation Error: {e.ValidationMessage}");
                return;
    }

                // 2. Access text data directly
                Console.WriteLine($"Processing input from {e.ControlName}");
                Console.WriteLine($"Text: {e.Text} (Length: {e.Length})");

                // 3. Perform Search or Submit Action
                PerformSearch(e.Text);
};
Other Key Events
// 1. TextUpdated
// Fires specifically when the text property changes.
// Provides both old and new text values.
txt.TextUpdated += (s, e) => 
{
                Debug.WriteLine($"Changed from '{e.PreviousText}' to '{e.CurrentText}'");
};

// 2. Validated (Custom)
// Fires after the ValidationFunction has executed.
txt.Validated += (s, e) => 
{
                if (!e.IsValid) 
    {
                UpdateStatusLabel(e.ErrorMessage);
    }
};

// 3. SystemThemeChanged
// Fires when the OS theme changes (requires TrackSystemTheme = true)
txt.SystemThemeChanged += (s, e) => 
{
                ApplyThemeColors(e.Theme);
};

Public Methods

Programmatic control over text selection and state.

Method Description
SelectAll() Selects all text within the control.
Select(int start, int length) Selects a range of text starting at the specified index.
Clear() Clears the text, resets cursor position, and triggers the placeholder animation.
Undo() / Redo() Triggered via keyboard shortcuts (Ctrl+Z, Ctrl+Y), but also accessible internally for custom context menus.

Usage Examples

Example 1: Email Validation with Visual Feedback

Configures the textbox to accept emails, validates the format using a lambda expression, and provides visual error cues.

C# - Email Setup
public void SetupEmailInput()
{
    txtEmail.PlaceholderText = "email@example.com";
    txtEmail.IsRequired = true;
    txtEmail.IsRequiredErrorColor = Color.Crimson;
    
                // Custom Validation Logic
    txtEmail.ValidationFunction = (input) => 
    {
                return input.Contains("@") && input.Contains(".");
    };
    txtEmail.ValidationErrorMessage = "Please enter a valid email address.";

                // Handle Enter Key to submit
    txtEmail.EnterKeyPressed += (s, e) => 
    {
                if (e.IsValid) 
                Login(e.Text);
                else
                MessageBox.Show(e.ValidationMessage);
    };
}

Example 2: Search Bar with Blinking Shadow

Creates a search field that draws attention to itself using the blinking shadow effect.

C# - Search Bar
public void HighlightSearchBar()
{
    txtSearch.PlaceholderText = "Search database...";
    
                // Enable Drop Shadow
    txtSearch.EnableDropShadow = true;
    txtSearch.ShadowColor = Color.DodgerBlue;
    txtSearch.ShadowBlur = 15;

                // Blink 3 times to grab user attention
    txtSearch.BlinkCount = 3;
    txtSearch.BlinkShadow = true;
}