Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
105
How to remove padding on the status bar
posted

This doesn't seem like it should be a problem with Infragistics and feels like it should be trivially simple... but I only have this problem when using RibbonWindowContentHost so I thought I'd throw this out there and see if anyone else has run into this or knows what could be going on.

I am adding a StatusBar to a RibbonWindowContentHost.

For some reason, the Border inside the StatusBar is given a padding of 0,0,20,0.  I tried making an app in Blend without using infragistics and I have no such problem.  I've tried various ways to get rid of this padding but I can't seem to do it.

I tried setting the padding on my StatusBar to being 0 in xaml.  I tried setting it in code after adding it to the RibbonWindowContentHost.  I tried creating a control template that had no such padding.  But none of these things worked for me.

I always end up with 20 pixels of unused space on the right hand side.  Is there something strange going on under the covers of how RibbonWindowContentHost uses the StatusBar that would prevent me from getting rid of this padding?

The xaml for my StatusBar looks like this:

 <StatusBar x:Class="Geomagic.Apps.Generic.CommonResources.StatusBarControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Padding="0,0,0,0"
    >

    <StatusBarItem x:Name="statusBarItem">
        <Grid Width="{Binding ActualWidth, ElementName=statusBarItem, Mode=Default}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <DockPanel LastChildFill="True" Grid.Column="0">
                <TextBlock x:Name="_StatusText" TextTrimming="CharacterEllipsis" ToolTip="{Binding Text, ElementName=_StatusText, Mode=Default}"/>
            </DockPanel>
            <ProgressBar x:Name="_MainProgressBar" VerticalAlignment="Center" Grid.Column="1" Height="18" HorizontalAlignment="Center" Width="150"/>
            <TextBlock x:Name="_ProgressTime" HorizontalAlignment="Center" Grid.Column="1" VerticalAlignment="Center"/>
        </Grid>
    </StatusBarItem>
</StatusBar>

The visual tree according to snoop is:

StatusBarArea

   StatusBarControl

      StatusBar_BackgroundLayer

      StatusBar_ForegroundLayer

      Border <- this is the guy with padding of 0,0,20,0

        ItemsPresenter

             DockPanel

                   StatusBarItem

                           ...

Any ideas?

Parents
No Data
Reply
  • 54937
    Offline posted

    This seems like a bug. By default when you put a StatusBar into the RibbonWindowContentHost's StatusBar property it will change the Style of the StyleBar so that it is in sync with the look of the theme being used (e.g. Office 2007 blue). However this default style has a hard coded 20 pixel padding on the right in the element you indicated. I believe this was meant to leave space for when the resize grip was visible as that element is not part of the visual tree of the statusbar but the statusbar extends the width of the bottom and as such the gripper would overlap the panels otherwise. However this should have been triggered on the basis of whether the resize grip was actually there. I'll see about getting this written up and a case created for you. In the interim you can get around this by taking a copy of our statusbar style (in the DefaultStyles directory and has a key of igRibbon:RibbonWindowContentHost.StatusBarStyleKey), modify it to exclude this padding and then put that style into the ribbonwindowcontenthost's Resources.

Children