Ribbon Textblock and label look different

Ribbon for WPF Forum

Posted 8 years ago by Arthur Damen
Version: 11.2.0551
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar
Hi,
When i put a label into a ribbon , and besides that a textblock

the label looks more black and somewhat larger then the textblock that is somewhat smaller and not so black....

Bug?

Comments (7)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Arthur,

Can you please post a small snippet of XAML showing this and also indicate which theme you are using so that we can take a look?


Actipro Software Support

Posted 8 years ago by Arthur Damen
Avatar
theme is office2010

            <ribbon:Group Label="{x:Static res:Text.Presentation_Size}" Command="commands:PADSDesignerCommands.PresentationSizeGroup">
              <ribbon:StackPanel VerticalAlignment="Center"   ItemVariantBehavior="AlwaysLarge"  Grid.IsSharedSizeScope="True">
                <Grid  ClipToBounds="False" Margin="7,0,0,0" >
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition SharedSizeGroup="PresWidth" ></ColumnDefinition>
                    <ColumnDefinition SharedSizeGroup="PresHeight"></ColumnDefinition>
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="7"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                  </Grid.RowDefinitions>
                  <Label Margin="40,0,0,0">Width</Label>
                  <TextBlock Text="{x:Static res:Text.Width}" Padding="0" Margin="0,0,5,0" VerticalAlignment="Center" Grid.Row="0" Grid.Column="0"  ></TextBlock>
                  <TextBlock Text="{x:Static res:Text.Height}" Margin="0,0,5,0" Padding="0" VerticalAlignment="Center" Grid.Row="2" Grid.Column="0"  ></TextBlock>
                </Grid>
              </ribbon:StackPanel>
            </ribbon:Group>
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Arthur,

It just may be how those controls inherit down control properties. You can set these attributes on them as needed to get them looking the same as other ribbon controls:
Foreground="{DynamicResource {x:Static themes:AssetResourceKeys.ToolBarButtonForegroundNormalBrushKey}}"
FontSize="{DynamicResource {x:Static ribbon:RibbonMeasurements.UIFontSize}}"


Actipro Software Support

Posted 8 years ago by Arthur Damen
Avatar
Sure the controls follow the inherited colors, but they act different from the default windows label,textblock. So Actipro changes the default behaviour.
They act as a label is a textblock and a textblock is a label. So you changed them.
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Sorry but I'm not sure what you mean. I don't believe we have any styles in Ribbon that target Label or TextBlock at all.


Actipro Software Support

Posted 8 years ago by Arthur Damen
Avatar
Example 2
Open the xaml window and see the difference in black/gray for the textblock inside the ribbonbar. Underneigth they are also in the main window where the textblock looks different.

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
    xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
    xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
    <Label Margin="0,200,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" >LABEL</Label>
    <TextBlock Margin="100,200,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" >TEXTBLOCK</TextBlock>
    <ribbon:Ribbon>
      <ribbon:Ribbon.Tabs>
        <ribbon:Tab Name="Home"  Label="Home" >
          <ribbon:Group Name="GroupHomeConnection" Label="Test">
            <Label>LABEL</Label>
            <TextBlock>TEXTBLOCK</TextBlock>
          </ribbon:Group>
        </ribbon:Tab>
      </ribbon:Ribbon.Tabs>
    </ribbon:Ribbon>
  </Grid>
</Window>
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Arthur,

As we mentioned, the TextBlock would inherit it's Foreground color from it's ancestors, which in this case is the ribbon:Group. In the case where the TextBlock is outside the Ribbon, it ultimately inherits it's Foreground from the Window. This is a standard WPF behavior.


Actipro Software Support

The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.