How do I create custom layout for StatusBar items?

Platform: WPF| Category: StatusBar

StatusBar uses a DockPanel as an item template and docks all the items in the control to the left except for the last item. The last item takes the rest of the space in the statusbar. To have a custom layout for the statusbar control, you can change the DockPanel to a StackPanel, WrapPanel etc. You can also align the items in the statusbar using the DockPanel.Dock property for each statusbar item.

The following lines of code are used to change the alignment of the statusbar items.

[XAML]

<StatusBar Height='30' VerticalAlignment='Bottom' Background='Azure'>
<StatusBarItem DockPanel.Dock='Right'>
      	<TextBlock Text='Welcome to WPF!!'/>
</StatusBarItem>
      <StatusBarItem>
      	<TextBlock Text='Hello World! '/>
</StatusBarItem>
</StatusBar>

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.