Adding a status bar to your window
The status bar is used to show various information about the current state of the application. You can use this to show cursor position, word counts, progress of tasks, and more. Generally, a status bar is placed at the bottom of the window whereas the menus, toolbars are placed at the top.
In this recipe, we will learn how to add a status bar in a WPF window.
Getting ready
To get started with the status bar, let's create a WPF application project called CH02.StatusBarDemo
.
How to do it...
Once you create the WPF project, open the MainWindow.xaml
page and follow these steps to add the StatusBar
control to the window:
- Inside the
Grid
panel, add aStatusBar
tag and set itsHeight
to26
andVerticalAlignment
toBottom
.
- Now change its items panel template to host a
Grid
with five columns (we will discuss more about grid columns in the next chapter), as shown here:
<StatusBar.ItemsPanel> <ItemsPanelTemplate> <Grid> <...