StatusBarとは?
StatusBarとは,画面の一番下で,処理の状況やガイダンスを表示するためによく使われるコントロールです。「処理中です…」や「保存しました」などが表示されたり,処理の進捗状況をプログレスバーで表示したりします。
StatusBarの書き方
ステータスバーは「StatusBar」の中に,任意のコントロールを並べることで実現できます。
<StatusBar VerticalAlignment="Bottom"> <Label Content="処理しています..."/> </StatusBar>
Separator
ステータスバーの中の任意のコントロール同士の間を,縦線で区切って見た目をわかりやすくする場合はSeparatorを設置します。
<Label Content="60%"/> <Separator/> <Label Content="処理しています..."/>
サンプルコード全体
<Window x:Class="WPF027.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WPF027" mc:Ignorable="d" Title="MainWindow" Height="200" Width="300"> <Grid> <StatusBar VerticalAlignment="Bottom"> <ProgressBar Width="60" Height="20" Value="60" /> <Label Content="60%"/> <Separator/> <Label Content="処理しています..."/> </StatusBar> </Grid> </Window>