Senin, 16 September 2013

How to Customize Status Bar in WPF

In earlier post, we have learnt about placing a status bar and add some items on that. WPF provides some advanced options with status bar i.e. we can add some more items or even containers in status bar. In this article we will add a stack panel, image and some more items in a status bar.

Just write the following code in our XAML code window:
<StatusBar Name="statusBar" VerticalAlignment="Bottom">
<StackPanel Orientation="Horizontal">
<StackPanel>
<StatusBarItem Margin="5" >Status 1</StatusBarItem>
<StatusBarItem Margin="5" >Status 2</StatusBarItem>
<StatusBarItem Margin="5" >Status 3</StatusBarItem>
</StackPanel>
<Image Margin="5" Source="wall.jpg" Width="100" Height="30"></Image>
<ProgressBar Width="150" Height="20" Name="progressBar" Value="45"
HorizontalAlignment="Right" Margin="5"></ProgressBar>
</StackPanel>
</StatusBar>

Run the project and it will show a window with three strings in a stack panel, an image and a progress bar. The first stack panel also contain a nested stack panel. These items are added just for example, not for any purpose.

Customize status bar in WPF


Just like the above code, we can place any control in the status bar, according to our requirements.

Tidak ada komentar:

Posting Komentar