Siticone Toggle Button
The SiticoneToggleButton is a stateful button that switches between "On" and "Off" states when clicked.
It goes beyond basic functionality by offering rich visual transitions like Slide, Flip, Zoom, and Bounce effects, along with customizable colors for every state.
State & Content
Configure how the button behaves and what it displays in each state.
| Property | Type | Description |
|---|---|---|
IsToggled |
bool | The primary state of the control. True means ON, False means OFF. |
ToggledText |
string | The text displayed when the button is in the ON state (Default: "On"). |
UntoggledText |
string | The text displayed when the button is in the OFF state (Default: "Off"). |
IsReadonly |
bool | When true, the button cannot be toggled by the user, though it remains visible. |
Visual Styling
Define distinct color palettes for the Toggled (Active) and Untoggled (Inactive) states.
| Property | Type | Description |
|---|---|---|
ToggledBackColor |
Color | Background color when active. |
UntoggledBackColor |
Color | Background color when inactive. |
ToggledForeColor |
Color | Text color when active. |
UntoggledForeColor |
Color | Text color when inactive. |
HoverColor |
Color | Overlay color when the mouse hovers over the control. |
PressColor |
Color | Overlay color when the control is pressed. |
Animations & Effects
The control features a powerful animation engine that interpolates between states.
| Property | Type | Description |
|---|---|---|
AnimationStyle |
Enum |
Choose the transition effect:
Fade, Slide, Flip, Zoom, Bounce, Spin, Rotate, Pulse, Ripple.
|
AnimationDuration |
int | Time in milliseconds for the state transition to complete (Default: 200ms). |
EnableRippleEffect |
bool | Enables a material-design style ripple wave upon clicking. |
RippleColor |
Color | The color of the ripple wave. |
Borders & Shape
Customize the physical geometry of the button.
| Property | Type | Description |
|---|---|---|
CornerRadius... |
float | Individual radius settings for TopLeft, TopRight, BottomLeft, BottomRight. |
BorderThickness |
float | Width of the border stroke. |
BorderStyleOption |
Enum | Solid, Dashed, Dotted, Double, Groove, Ridge, etc. |
ToggledBorderColor |
Color | Border color when active. |
UntoggledBorderColor |
Color | Border color when inactive. |
Events
React to state changes and interactions.
// Fired whenever IsToggled changes.
toggleBtn.StateChanged += (s, e) =>
{
if (toggleBtn.IsToggled)
{
StartService();
}
else
{
StopService();
}
};
// Specific events for each state direction.
toggleBtn.ToggledOn += (s, e) => Console.WriteLine("Power On!");
toggleBtn.ToggledOff += (s, e) => Console.WriteLine("Power Off!");
Designer Support
The control provides a rich Smart Tag menu for quick configuration.
| Category | Features |
|---|---|
Themes |
Instant presets: Modern, Material Design, iOS 15, Flat, Neon, Retro, etc. |
Copy & Paste |
Copy visual settings from one toggle button to another effortlessly. |
Usage Examples
Example 1: Mode Switcher
A button to toggle between "Light" and "Dark" modes.
private void SetupThemeToggle()
{
themeToggle.ToggledText = "Dark Mode";
themeToggle.UntoggledText = "Light Mode";
// Apply Modern Theme via code
themeToggle.ApplyModernToggleTheme();
themeToggle.StateChanged += (s, e) =>
{
SetAppTheme(themeToggle.IsToggled ? Theme.Dark : Theme.Light);
};
}
Example 2: iOS Style Switch
Configuring the button to look like an iOS toggle switch using the Slide animation.
private void ApplyiOSLook()
{
iosBtn.ToggledBackColor = Color.FromArgb(52, 199, 89); // iOS Green
iosBtn.UntoggledBackColor = Color.FromArgb(229, 229, 234); // iOS Gray
iosBtn.AnimationStyle = ToggleAnimationStyle.Slide;
iosBtn.BorderThickness = 0;
iosBtn.TopLeftRadius = 15; // Fully rounded
iosBtn.TopRightRadius = 15;
iosBtn.BottomLeftRadius = 15;
iosBtn.BottomRightRadius = 15;
iosBtn.ToggledText = ""; // No text for switch look
iosBtn.UntoggledText = "";
}
Example 3: Interactive Feedback
Using CanShake and IsReadonly to indicate a locked feature.
private void SetupProFeature()
{
btnPro.Text = "PRO Feature";
btnPro.IsReadonly = true;
btnPro.CanShake = true;
btnPro.CanBeep = true;
// Set disabled look
btnPro.DisabledBackColor = Color.LightGray;
}