How is the StatusBarItem class supposed to be used? Is every element in a StatusBar‘s content supposed to be wrapped with it?
I don’t really understand how StatusBarItem affects the StatusBar layout. It seems like I can use HorizontalAlignment on a StatusBarItem, but not when I put the element in the StatusBar directly:
<StatusBar>
<TextBlock HorizontalAlignment="Right" Text="Not right" />
<StatusBarItem HorizontalAlignment="Center">
<TextBlock Text="Center" />
</StatusBarItem>
</StatusBar>
Also if you wrap a Separator in a StatusBarItem the Separator changes to horizontal. Separators default to vertical when put in the StatusBar directly without a StatusBarItem wrapper.
A
StatusBaris anItemsControl. AllItemsControls have a container class. ForListBoxes, it’sListBoxItem. ForStatusBar, it’sStatusBarItem. If you don’t explicitly wrap your item in aStatusBarItem, it will be implicitly wrapped in one for you.If you need to set properties of an
ItemsControl‘s containers, you can use theItemContainerStyleproperty:Finally, note that the
StatusBaruses aDockPanelby default to lay out its children. This can be frustrating when you’re doing intricate layouts. See my blog post here on how to swap it out for aGrid.