This documentation is archived and is not being maintained.

StatusBarItem Class

Represents an item of a StatusBar control.

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

[LocalizabilityAttribute(LocalizationCategory.Inherit)] 
public class StatusBarItem : ContentControl
/** @attribute LocalizabilityAttribute(LocalizationCategory.Inherit) */ 
public class StatusBarItem extends ContentControl
LocalizabilityAttribute(LocalizationCategory.Inherit) 
public class StatusBarItem extends ContentControl
<StatusBarItem>
  Content
</StatusBarItem>

Content Model: StatusBarItem is a ContentControl and has one content property: Content. For information about how to set this property, see the Content Control Content Model overview.

StatusBarItem objects are used to define items in a StatusBar control. A StatusBar is a horizontal area at the bottom of a parent window in which an application can display status information. A StatusBarItem can contain complex content, such as graphics and text, and can receive events. The StatusBar and StatusBarItem objects cannot receive keyboard focus.

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.ContentControl
                System.Windows.Controls.Primitives.StatusBarItem

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
Show: