Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Separator in StatusBar

I have a WPF Window with a StatusBar control. Below is the xaml for my status bar. I am trying to place a Separator between the StatusBarItems. But what happens is that all the separators are positioned right after the first StatusBarItem.

How can I get the Separators to be positioned after each Item in the StatusBar?

I do notice that if I am not using the ItemsPanelTemplate that the separators work correctly. How can I get the separators in the below xaml to position correctly?

        <StatusBar Grid.Row="2" Height="23" Name="myStatusBar" VerticalAlignment="Bottom" >
        <StatusBar.ItemsPanel>
            <ItemsPanelTemplate>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="100"/>
                    </Grid.ColumnDefinitions>
                </Grid>
            </ItemsPanelTemplate>
        </StatusBar.ItemsPanel>
        <StatusBarItem Grid.Column="0">
            <StackPanel Orientation="Horizontal">
                <Image Source="..\Images\bullet_green.png" Height="15" Width="15" />
                <TextBlock Name="txtStatus" Height="18" Width="77" Text="{Binding StatusBarStatus}"/>
            </StackPanel>
        </StatusBarItem>
<Separator Width="1"/>
        <StatusBarItem Grid.Column="1">
            <StackPanel Orientation="Horizontal">
                <Image Source="..\Images\user_add.png" Height="15" Width="15" />
                <TextBlock Name="txtCurrentContact" Text="{Binding StatusBarCurrentContact}" />
            </StackPanel>
        </StatusBarItem>
<Separator Width="1"/>
        <StatusBarItem Grid.Column="2">
            <!--<ProgressBar Value="30" Width="80" Height="18"/>-->
            <StackPanel Orientation="Horizontal">
                <Image Source="..\Images\database03.png" Height="15" Width="15" />
                <TextBlock Name="txtDatabase" Text="{Binding StatusBarDatabase}" />
            </StackPanel>
        </StatusBarItem>
<Separator Width="1"/>
        <StatusBarItem Grid.Column="3">
            <TextBlock Name="txtMode" Text="{Binding StatusBarMode}"/>
        </StatusBarItem>

        <StatusBarItem Grid.Column="4">
            <TextBlock Name="txtTally" Text="{Binding StatusBarTally}"/>
        </StatusBarItem>
    </StatusBar>
like image 637
Jerry Avatar asked Jan 26 '12 21:01

Jerry


1 Answers

All of your separators are in Column 0. Put them in a column ie:

 <StatusBarItem Grid.Column="0">
        <StackPanel Orientation="Horizontal">
            <Image Source="..\Images\bullet_green.png" Height="15" Width="15" />
            <TextBlock Name="txtStatus" Height="18" Width="77" Text="{Binding StatusBarStatus}"/>
        </StackPanel>
    </StatusBarItem>
    <Separator Width="1" Grid.ColumnSpan="2" Grid.Column="0" HorizontalAlignment="Center"/>
    <StatusBarItem Grid.Column="1">
        <StackPanel Orientation="Horizontal">
            <Image Source="..\Images\user_add.png" Height="15" Width="15" />
            <TextBlock Name="txtCurrentContact" Text="{Binding StatusBarCurrentContact}" />
        </StackPanel>
    </StatusBarItem>
like image 62
MyKuLLSKI Avatar answered Sep 19 '22 23:09

MyKuLLSKI