Bunifu Framework Docs
HomePricingFAQsMy Account
  • Introduction
  • Getting started
    • Requirements
    • Installation
    • Installing for .Net 5 & Above
    • Licensing
      • Managing your licenses
      • Bunifu Licensing CLI
      • Bunifu Device Remover (Deprecated)
  • BUNIFU UI
    • Controls
      • Bunifu Button
      • Bunifu Button (variant)
      • Bunifu Cards
      • Bunifu CheckBox
      • Bunifu Circle Progress
      • Bunifu Datagrid View
      • Bunifu Date Picker
      • Bunifu Drop Down
      • Bunifu Flat Button
      • Bunifu Form Caption Button
      • Bunifu Form Control Box
      • Bunifu Form Resize Icon
      • Bunifu Gradient Panel
      • Bunifu Icon Button
      • Bunifu Image Button (New)
      • Bunifu Image Button (Old)
      • Bunifu IOS Switch (1.5.3)
      • Bunifu Label
      • Bunifu Loader
      • Bunifu Picture Box
      • Bunifu Pages
      • Bunifu Panel
      • Bunifu Progress Bar
      • Bunifu Radial Gauge
      • Bunifu Radio Button
      • Bunifu Rating
      • Bunifu Range
      • Bunifu Separator
      • Bunifu Sliders
      • Bunifu Shadow Panel
      • Bunifu Shapes
      • Bunifu Switch (1.5.3)
      • Bunifu ScrollBars
      • Bunifu Toggle Switch
      • Bunifu Toggle Switch (variant)
      • Bunifu Tile Button
      • Bunifu Thin Button (1.5.3)
      • Bunifu ToolTip
      • Bunifu Textbox
      • Bunifu User Control
    • Components
      • Bunifu Color Transition
      • Bunifu Drag
      • Bunifu Elipse [Deprecated]
      • Bunifu Form Dock
      • Bunifu Form Drag
      • Bunifu Form Resizer
      • Bunifu Snackbar
      • Bunifu Transition
  • BUNIFU CHARTS
    • Introduction
      • Quick Tips
    • Chart Components
      • Bunifu Bar Chart
      • Bunifu Bubble Chart
      • Bunifu Canvas Control
      • Bunifu Doughnut Chart
      • Bunifu Horizontal bar Chart
      • Bunifu Line Chart
      • Bunifu Pie chart
      • Bunifu Polar Chart
      • Bunifu Radar Chart
  • BUNIFU DATAVIZ [Deprecated]
    • Basic Charts [Deprecated]
      • Step Line Chart [Deprecated]
      • Step Area Chart [Deprecated]
      • Spline Chart [Deprecated]
      • Pie Chart [Deprecated]
      • Line Chart [Deprecated]
      • Doughnut Chart [Deprecated]
      • Bar Chart [Deprecated]
      • Area Chart [Deprecated]
      • Column Chart [Deprecated]
    • Advanced Charts [Deprecated]
      • Stacked Column 100 Chart [Deprecated]
      • Stacked Column Chart [Deprecated]
      • Stacked Bar Chart 100 [Deprecated]
      • Stacked Bar Chart [Deprecated]
      • Stacked Area Chart 100 [Deprecated]
      • Stacked Area Chart [Deprecated]
      • Scatter Chart [Deprecated]
      • Range Spline Area Chart [Deprecated]
      • Range Column Chart [Deprecated]
      • Range Bar Chart [Deprecated]
      • Range Area Chart [Deprecated]
      • OHLC Chart [Deprecated]
      • Candle Stick Chart [Deprecated]
      • Bubble Chart [Deprecated]
Powered by GitBook
On this page
  • Overview
  • Getting Started
  • Getting started with design view
  • Adding the toggle switch at Run-time
  • Properties
  • 1. Checked
  • 2. CheckedBackColor
  • 3. UncheckedBackColor
  • 4. CheckedSwitchColor
  • 5. CheckedSwitchStyle
  • 6. UncheckedSwitchColor
  • 7. UncheckedSwitchStyle
  • 8. OutlineThickness
  • Take Away

Was this helpful?

  1. BUNIFU UI
  2. Controls

Bunifu Toggle Switch (variant)

Rapidly generate stylish toggle switches with the new variant

PreviousBunifu Toggle SwitchNextBunifu Tile Button

Last updated 3 years ago

Was this helpful?

Overview

Bunifu Toggle Switch variant is a newly calibrated toggle switch with considerably great features in its design that the default Bunifu Toggle control may be unable to render.

Getting Started

This section describes adding Bunifu Toggle Switch (variant) at the designer level and during a runtime event.

Getting started with design view

Bunifu Toggle Switch is added to a Form by simply locating BunifuToggleSwitch2 in your Visual Studio toolbox, and dragging it to the form as demonstrated below. You can quickly customize the control using its properties in the smart tag. Later in this documentation, we will get into deeper detail about its features.

Adding the toggle switch at Run-time

To add Bunifu Toggle Switch at runtime, we will use the Form's load event to instantiate BunifuToggleSwitch2 and add it to the form as shown in the codes below:

private void Form1_Load(object sender, EventArgs e)
{
    //instatiate the toggle using Bunifu.UI.WinForms
    BunifuToggleSwitch2 bunifuToggle = new BunifuToggleSwitch2();
    //set the location of the toggle switch
    bunifuToggle.Location = new Point(294, 160);
    //set the toggle switch on an on-state 
    bunifuToggle.Checked = true;
    //set the checked switch style to outline
    bunifuToggle.CheckedSwitchStyle = BunifuToggleSwitch2.SwitchStyles.Outline;
    //add the control to the form
    this.Controls.Add(bunifuToggle);
}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
	'instatiate the toggle using Bunifu.UI.WinForms
	Dim bunifuToggle As New BunifuToggleSwitch2()
	'set the location of the toggle switch
	bunifuToggle.Location = New Point(294, 160)
	'set the toggle switch on an on-state 
	bunifuToggle.Checked = True
	'set the checked switch style to outline
	bunifuToggle.CheckedSwitchStyle = BunifuToggleSwitch2.SwitchStyles.Outline
	'add the control to the form
	Me.Controls.Add(bunifuToggle)
End Sub

Let's deep dive and get insights into the available properties on the variant Bunifu Toggle Switch.

Properties

1. Checked

This property determines the toggle state of the control. When the property is set to true, it sets the toggle switch in an On state. By default the toggle switch is set on an Off state.

The CheckedChanged event fires whenever the toggle state changes. Here's a code snippet that changes the label text whenever the state changes.

private void bunifuToggleSwitch_CheckedChanged(object sender, EventArgs e)
{
    if (bunifuToggleSwitch.Checked)
    {
        bunifuLabel.Text = "ON";
    }
    else{
        bunifuLabel.Text = "OFF";    
    }
}
Private Sub bunifuToggleSwitch_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
	If bunifuToggleSwitch.Checked Then
		bunifuLabel.Text = "ON"
	Else
		bunifuLabel.Text = "OFF"
	End If
End Sub

2. CheckedBackColor

This property allows you to get or set the switch's box background color when the switch is on an On State. It supports both RGB and HEX color values.

3. UncheckedBackColor

This property allows you to get or set the switch's box background color when the switch is in an Off State. It supports both RGB and HEX color values.

4. CheckedSwitchColor

This property allows you to get or set the fill color of the switch thumb when the switch is on an On State. It supports both RGB and HEX color values.

5. CheckedSwitchStyle

This property allows you to get or set the surface style (enumeration) for the switch thumb when the switch is in an On State. The enumeration defines the following values: Fill and Outline.

6. UncheckedSwitchColor

This property allows you to get or set the fill color of the switch thumb when the switch is on an Off State. It supports both RGB and HEX color values.

7. UncheckedSwitchStyle

This property allows you to get or set the surface style (enumeration) for the switch thumb when the switch is in an Off State. The enumeration defines the following values: Fill and Outline.

8. OutlineThickness

This property allows you to set a thickness value for the switch thumb when its style set to outline. By increasing the value, the outline border of the swtich thumb becomes thicker.

Take Away

You can now generate more elegant toggle switches, which we hope will improve the appearance and feel of your UI while also providing a better user experience.

Please contact us via chat in the bottom right corner of the screen if you have feedback or recommendations.