Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

StatusBar Class

Represents a control that displays items and information in a horizontal bar in an application window.

Namespace: System.Windows.Controls.Primitives
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=typeof(StatusBarItem))] 
public class StatusBar : ItemsControl
/** @attribute StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=System.Windows.Controls.Primitives.StatusBarItem) */ 
public class StatusBar extends ItemsControl
StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=System.Windows.Controls.Primitives.StatusBarItem) 
public class StatusBar extends ItemsControl
<StatusBar>
  Items
</StatusBar>

Content Model: StatusBar is an ItemsControl and has two content properties: Items and ItemsSource. For information about how to set these properties, see the Items Control Content Model overview.

A StatusBar is a bar that typically displays a horizontal row of images and status information. You can divide the items in a StatusBar into groups that contain related items, by using Separator controls. The items in a StatusBar can display text, graphics, or other complex content. Items in a StatusBar are defined as StatusBarItem objects.

Events that are defined on a StatusBarItem are raised when the user clicks the item in the StatusBar.

The StatusBar does not receive keyboard focus.

The following illustration shows an example of a StatusBar.

Status Bar

Status bar

A StatusBar is a horizontal window at the bottom of a parent window in which an application can display various kinds of status information.

The following example shows how to define a StatusBar by using Extensible Application Markup Language (XAML) and how to add a ProgressBar by using code.

<StatusBar Name="sbar" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" 
           VerticalAlignment="Bottom" Background="Beige" > 
     <StatusBarItem>
       <TextBlock>Ready</TextBlock>
     </StatusBarItem>
     <StatusBarItem>
       <Separator Style="{StaticResource StatusBarSeparatorStyle}"/>
     </StatusBarItem>
</StatusBar>

private void MakeProgressBar(object sender, RoutedEventArgs e)
{
  sbar.Items.Clear();
  TextBlock txtb = new TextBlock();
  txtb.Text = "Progress of download.";
  sbar.Items.Add(txtb);
  ProgressBar progressbar = new ProgressBar();
  Duration duration = new Duration(TimeSpan.FromSeconds(10));
  DoubleAnimation doubleanimation = 
                             new DoubleAnimation(100.0, duration);
  progressbar.BeginAnimation(ProgressBar.ValueProperty, 
                             doubleanimation);
  ToolTip ttprogbar = new ToolTip();
  ttprogbar.Content = "Shows the progress of a download.";
  progressbar.ToolTip = (ttprogbar);
  sbar.Items.Add(progressbar);
} 

The following example shows how to add two Image controls that are separated by a Separator control.

Image helpImage = new Image();
 helpImage.Width = 16;
 helpImage.Height = 16;
 BitmapImage bi = new BitmapImage();
 bi.BeginInit();
 bi.UriSource = new Uri(@"pack://application:,,,/images/help.bmp");
 bi.EndInit();
 helpImage.Source = bi;
 ToolTip ttp = new ToolTip();
 ttp.Content = "HELP";
 helpImage.ToolTip = (ttp);
 sbar.Items.Add(helpImage);

 Separator sp = new Separator();
 sp.Style = (Style)FindResource("StatusBarSeparatorStyle");
 sbar.Items.Add(sp);
 
 Image printImage = new Image();
 printImage.Width = 16;
 printImage.Height = 16;
 BitmapImage bi_print = new BitmapImage();
 bi_print.BeginInit();
 bi_print.UriSource = new Uri(@"pack://application:,,,/images/print.bmp");
 bi_print.EndInit();
 printImage.Source = bi_print;
 ToolTip ttp_print = new ToolTip();
 ttp.Content = "Sent to printer.";
 printImage.ToolTip = (ttp_print);
 sbar.Items.Add(printImage);

For the complete sample, see StatusBar Sample.

System.Object
   System.Windows.Threading.DispatcherObject
     System.Windows.DependencyObject
       System.Windows.Media.Visual
         System.Windows.UIElement
           System.Windows.FrameworkElement
             System.Windows.Controls.Control
               System.Windows.Controls.ItemsControl
                System.Windows.Controls.Primitives.StatusBar

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

Show:
© 2014 Microsoft