Left and Right justify StatusBar elements

September 28, 2009
I wanted to create a StatusBar with a left and right justified element.

StatusBarPic

I found some XAML that suggested a fix...

<StatusBar>
    <StatusBarItem DockPanel.Dock="Right">
        <TextBlock>Set</TextBlock>
    </StatusBarItem>
    <StatusBarItem>
        <TextBlock>Ready</TextBlock>
    </StatusBarItem>
</StatusBar>

Funny thing was I didn't even have the DockPanel.Dock tag available for my StatusBarItem, so I solved the problem like this.

<StatusBar DockPanel.Dock="Bottom">
 <StatusBarItem HorizontalAlignment="Left">
 <Label Name="StatusTxt" Content="{Binding StatusMessage}"/>
 </StatusBarItem>
 <StatusBarItem HorizontalAlignment="Right">
 <Label Name="HotKey" Content="Ctrl+Alt+C To Show/Hide"/>
 </StatusBarItem>
</StatusBar>
Advertisements

Hello world!

September 28, 2009

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!