Edit this page

This article demonstrates what items can be added to RadStatusStrip either at design time or at run time.

Item Element Types

The following element types can be added to RadStatusStrip.Items collection:

  • RadLabelElement
  • CommandBarSeparator
  • RadButtonElement
  • RadCheckBoxElement
  • RadImageButtonElement
  • RadProgressBarElement
  • RadRadioButtonElement
  • RadRepeatButtonElement
  • RadSplitButtonElement
  • RadStatusStripPanelElement
  • RadToggleButtonElement
  • RadTrackBarElement
  • RadWaitingBarElement

Adding Items At Design-Time

There are several alternatives for adding and editing the RadStatusStrip.Items collection in the designer:

  • Click on the Type here label and edit directly. When you're done, click Enter to save your changes. Click Esc to abandon the changes.

  • Click the down arrow in the Type here label and select the desired element to add.

Figure 1: Add items at design time

forms-and-dialogs-statusstrip-working-with-radstatusstrip-items 001

  • From the Properties Editor select the Items property ellipses to open the RadItem Collection Editor.

Figure 2: RadItem Collection Editor

forms-and-dialogs-statusstrip-working-with-radstatusstrip-items 003

Adding Items At Run-Time

Add items at run time by creating RadElement instances and adding them to the RadStatusStrip.Items collection. The example below demonstrates creating and adding RadLabelElement, RadButtonElement, RadRepeatButtonElement, RadToolBarSeparatorElement and RadProgressBarElement.

Figure 3: Adding items at run time

forms-and-dialogs-statusstrip-working-with-radstatusstrip-items 002

Adding elements to RadStatusStrip

private void StatusStrip1_Load(object sender, EventArgs e)
{
    RadLabelElement labelElement = new RadLabelElement();
    labelElement.Text = "My LabelElement";
    RadButtonElement buttonElement = new RadButtonElement();
    buttonElement.Text = "My ButtonElement";
    buttonElement.Click += new EventHandler(buttonElement_Click);
    RadRepeatButtonElement repeatButtonElement = new RadRepeatButtonElement();
    repeatButtonElement.Text = "My Repeat button";
    repeatButtonElement.Click += new EventHandler(repeatButtonElement_Click);
    CommandBarSeparator separator = new CommandBarSeparator();
    RadProgressBarElement progressBarElement = new RadProgressBarElement();
    progressBarElement.Text = "My Progress Bar";
    radStatusStrip1.Items.AddRange(new RadItem[] {labelElement, buttonElement, repeatButtonElement, separator, progressBarElement}); 
}
void repeatButtonElement_Click(object sender, EventArgs e)
{
    (radStatusStrip1.Items[0] as RadLabelElement).Text = "Clicked repeat button on " + DateTime.Now.ToLongTimeString();
}
void buttonElement_Click(object sender, EventArgs e)
{
    MessageBox.Show("Clicked on ButtonElement");
}

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim labelElement As New RadLabelElement()
    labelElement.Text = "My LabelElement"
    Dim buttonElement As New RadButtonElement()
    buttonElement.Text = "My ButtonElement"
    AddHandler buttonElement.Click, AddressOf buttonElement_Click
    Dim repeatButtonElement As New RadRepeatButtonElement()
    repeatButtonElement.Text = "My Repeat button"
    AddHandler repeatButtonElement.Click, AddressOf repeatButtonElement_Click
    Dim separator As New CommandBarSeparator()
    Dim progressBarElement As New RadProgressBarElement()
    progressBarElement.Text = "My Progress Bar"
    RadStatusStrip1.Items.AddRange(New RadItem() {labelElement, buttonElement, repeatButtonElement, separator, progressBarElement})
End Sub
Sub repeatButtonElement_Click(ByVal sender As Object, ByVal e As EventArgs)
    TryCast(RadStatusStrip1.Items(0), RadLabelElement).Text = "Clicked repeat button on " + DateTime.Now.ToLongTimeString()
End Sub
Sub buttonElement_Click(ByVal sender As Object, ByVal e As EventArgs)
    MessageBox.Show("Clicked on ButtonElement")
End Sub

See Also