Siticone iOS Switch
The SiticoneiOSSwitch is a high-fidelity toggle control that replicates the smooth, fluid experience of native iOS switches.
It features advanced physics-based animations (thumb stretching), a clean borderless look, and extensive color customization for all states.
Animation Physics
The control uses a sophisticated animation engine to simulate the "sticky" feel of mobile toggles.
| Property | Type | Description |
|---|---|---|
EnableThumbStretching |
bool | Enables the signature iOS effect where the thumb elongates horizontally during the transition, simulating velocity. |
ThumbStretchFactor |
float | Controls the intensity of the stretch (0.0 to 1.0). Default is 0.35. Higher values make the thumb stretch more dramatically mid-animation. |
AnimationDuration |
int | Duration of the state change in milliseconds. Default is 200ms for a snappy feel. |
Visual Appearance
Customize the track, thumb, and borders for every state.
| Property | Type | Description |
|---|---|---|
OnBackColor |
Color | Background color of the track when active (Default: iOS Green). |
OffBackColor |
Color | Background color of the track when inactive (Default: Light Gray). |
ThumbColor |
Color | Color of the sliding circle thumb. |
ThumbShadowSize |
float | Size of the drop shadow under the thumb for depth (Default: 3.0). |
ThumbSize |
int | Diameter of the thumb in pixels. |
Behavior & Performance
Settings to control interactivity and optimize rendering.
| Property | Type | Description |
|---|---|---|
UltraFastMode |
bool | Disables non-essential visual effects like shadows and thumb stretching for maximum performance in data-heavy lists. |
AutoSize |
bool | Automatically adjusts the control width based on the ThumbSize to maintain aspect ratio. |
IsReadOnly |
bool | Locks the switch. Clicking it triggers visual/audio feedback instead of toggling. |
Events
// Fired when the Checked state changes.
iosSwitch.StateChanged += (s, e) =>
{
if (e.IsOn)
{
Console.WriteLine("Enabled at " + e.ChangeTime);
}
};
// Fired when a user clicks a ReadOnly switch.
iosSwitch.ReadOnlyInteractionAttempt += (s, e) =>
{
MessageBox.Show("This setting is managed by your administrator.");
};
Designer Support
Includes a comprehensive Smart Tag menu with modern presets.
| Category | Features |
|---|---|
Themes |
Presets like Default iOS, Dark, Material Design, Flat, Minimalist. |
Animation |
Sliders for Animation Duration and Thumb Stretch Factor. |
Appearance |
Quick access to Thumb Size, Shadow Size, and Colors. |
Usage Examples
Example 1: Standard iOS Settings Toggle
Replicating the look of the iPhone settings menu.
private void SetupWifiSwitch()
{
switchWifi.OnBackColor = Color.FromArgb(52, 199, 89); // iOS Green
switchWifi.OffBackColor = Color.FromArgb(229, 229, 234); // iOS Gray
switchWifi.ThumbColor = Color.White;
switchWifi.ThumbShadowSize = 3.0f;
// Enable stretch animation
switchWifi.EnableThumbStretching = true;
switchWifi.ThumbStretchFactor = 0.35f;
}
Example 2: Dark Mode Toggle
A switch styled for dark interfaces.
private void SetupDarkSwitch()
{
switchDark.OnBackColor = Color.FromArgb(65, 105, 225); // Royal Blue
switchDark.OffBackColor = Color.FromArgb(60, 60, 60); // Dark Gray
switchDark.ThumbColor = Color.FromArgb(240, 240, 240); // Off-White
// Faster animation for snappy feel
switchDark.AnimationDuration = 150;
}
Example 3: High Performance List
Optimizing for a grid with 100+ switches.
private void SetupGridSwitches()
{
foreach (var switchCtrl in flowPanel1.Controls.OfType<SiticoneiOSSwitch>())
{
// Disable shadows and complex animations
switchCtrl.UltraFastMode = true;
switchCtrl.ThumbShadowSize = 0;
// Keep thumb stretching disabled for speed
switchCtrl.EnableThumbStretching = false;
}
}
Example 4: Secured Toggle
A read-only switch that requires authentication to change.
private void SetupAdminSwitch()
{
switchAdmin.IsReadOnly = true;
switchAdmin.CanShake = true;
switchAdmin.ReadOnlyInteractionAttempt += (s, e) =>
{
if (MessageBox.Show("Unlock settings?", "Admin", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
switchAdmin.IsReadOnly = false;
switchAdmin.Checked = !switchAdmin.Checked; // Manually toggle
}
};
}