Table of Contents

Using StatusBar

The AlterNET UI StatusBar control is used as an area, usually displayed at the bottom of a window, where an application can display various status information. StatusBar controls can have status bar panels that display text to indicate the state of the open document; for example, that the document is modified.

Using the StatusBar Control

Internet Explorer uses a status bar to indicate the URL of a page when the mouse rolls over the hyperlink; Microsoft Word gives you information on page location, section location, and editing modes such as overtype and revision tracking; and Visual Studio uses the status bar to provide context-sensitive information, such as telling you how to manipulate dockable windows as either docked or floating.

A status bar is divided into panels to display information using the Panels property. The StatusBar control allows you to create status bar panels by adding StatusBarPanel objects to a Panels collection. Each StatusBarPanel object should have Text assigned to be displayed in the status bar.

Working with the StatusBar Control

The following example shows how to use StatusBar component:

<Window>
    <Window.StatusBar>
        <StatusBar Name="statusBar">
            <StatusBarPanel Text="Ready" />
            <StatusBarPanel Name="clockStatusBarPanel" />
        </StatusBar>
    </Window.StatusBar>
</Window>
Timer clockTimer;

public MainWindow()
{
    InitializeComponent();

    clockTimer = new Timer(TimeSpan.FromMilliseconds(200), (o, e) => clockStatusBarPanel.Text = DateTime.Now.ToString("HH:mm:ss"));
    clockTimer.Start();
}