Bunifu Radio Button

Create stylishly themed and customizable Radio buttons with in-built look and feel features and more.

Overview

Bunifu Radio Button is a feature-rich .NET control whose primary purpose is the selection of one option from a list of pre-defined choices. It features different states and appearance customizations.

Getting Started

Adding Bunifu Radio Button At Design Time

Bunifu Radio Button is simply added to a form at the designer level by locating/searching BunifuRadioButton in your toolbox and dragging it to your form as shown below:

Next, you need to bind a label which will be your click target. To set it up:

Step one: Drag a Bunifu Label besides Bunifu Radio Button and give it a meaningful name.

Step two: Access Bunifu Radio's smart tag and set the BindingControl property to the value with the name of the Bunifu Label control:

Ensure that the AllowBindingControlLocation is checked.

Adding Bunifu Radio Button At Runtime

To add Bunifu Radio Button at run time, use the Load event of your Form to write the following code:

private void Form1_Load(object sender, EventArgs e)
{
    //instatiate Bunifu Radio Button using Bunifu.UI.WinForms;
    BunifuRadioButton bunifuRadio = new BunifuRadioButton();
    //set the location for the radio button
    bunifuRadio.Location = new Point(290, 150);
    //instatiate a Bunifu Label to bind to the radio button
    BunifuLabel bunifuLabel = new BunifuLabel();
    //set the text for the label
    bunifuLabel.Text = "Option one";
    //bind the label to Bunifu Radio
    bunifuRadio.BindingControl = bunifuLabel;
    bunifuRadio.AllowBindingControlLocation = true;
    //add the two controls to the form
    this.Controls.AddRange(new Control[] { bunifuRadio, bunifuLabel }) ;
}

Let's take a deep dive and get insights into the available properties on Bunifu Radio Button.

Appearance Properties

1. BorderThickness

This property allows you to get or set the height/ border height of the control. Only integer values are accepted in this property.

2. OutlineColor

This property allows you to get or set the border color of the radio button. It accepts RGB and HEX color values as inputs.

3. OutlineColorTabFocus

This property enables you to get or set the radio button's hover border color; the color is activated once the control is hovered over.

4. OutlineColorUnchecked

This property allows you to get or set the radio button's unchecked state border color.

5. RadioColor

This property allows you to get or set a color value fill for the inner circle; the color gets activated when the control is in the checked state.

6. RadioColorTabFocused

This property allows you to get or set a hover color value for the inner circle; the color gets activated once the control is hovered over.

Behavioral Properties

1. Checked

This property allows you to get or set the initial state of a Bunifu Radio Button. The property accepts a boolean value that, when true, toggles the radio button's state to a selected state.

Bunifu Radio buttons should always be placed under a group box or a panel defining a category for selection.

The checkedChanged event fires whenever the radio button state changes. Here's is a code implementing the event:

private void dailyBunifuRadioButton_CheckedChanged(object sender, Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs e)
{
    if (e.Checked)
    {
        MessageBox.Show("Daily updates set");
    }

}

private void weeklyBunifuRadioButton_CheckedChanged(object sender, Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs e)
{
    if (e.Checked)
    {
        MessageBox.Show("Weekly updates set");
    }
}

private void montlyBunifuRadioButton_CheckedChanged(object sender, Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs e)
{
    if (e.Checked)
    {
        MessageBox.Show("Monthly updates set");
    }
}

2. BindingControl

This property allows you to get or set a binding control (i.e., the control's click target e.g the Label, PictureBox, etc..).Typically, the label serves as the binding control or the click target. Only a few cases necessitate the use of additional .NET controls. The bound control receives the Radio Button control's click events, which set the control's state(checked or unchecked state).

In no case should the parent control of a Bunifu Radio Button be bound.

3. BindingControlPosition

This property allows you to get or set a position enumeration for the bound control. The position enumeration define the following values: (i.e., the Left and Right positions).

This property ensures adequate spacing between buttons and labels, making it crystal clear which choice corresponds to which label. This helps you to avoid situations where it is extremely difficult to see the correct radio button to click.

Take Away

Bunifu Radio button is a rich essential element of forms and when utilizing radio buttons, it is critical to ensure that this .NET UI element is predictable for users, as this improves users' ability to control the system.

We hope you have gained insights using Bunifu Radio Button and that it will help you create a better user experience for your users. Should you have feedback or suggestions please send us via chat on the bottom right corner of the screen.

Last updated