SKINDER
SKINDER

Reputation: 1020

How to remove vertical separating line between buttons in RibbonControlGroup?

I have added RibbonControlGroup as a container for my RibbonButton's:

                <RibbonGroup>
                  <RibbonControlGroup>
                    <RibbonButton/>
                    <RibbonButton/>
                  </RibbonControlGroup>
                </RibbonGroup>

But how to remove a vertical separating line between buttons in System.Windows.Controls.Ribbon.RibbonControlGroup?

I have <Setter Property="BorderBrush" Value="Transparent"/> in style definition for RibbonGroup, RibbonControlGroup and RibbonButton but the same problem remains...

Screenshot:

enter image description here

Upvotes: 0

Views: 1634

Answers (2)

Ajai Johal
Ajai Johal

Reputation: 89

The ControlTemplate for various RibbonControls has triggers that add a right hand side border when they are in a control group (i.e. the IsInControlGroup Property is True):

<!-- IsInControlGroup -->
<Trigger Property="IsInControlGroup" Value="True">
    <Setter TargetName="OuterBorder" Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Ribbon.BorderBrush}" />
    <Setter TargetName="OuterBorder" Property="BorderThickness" Value="0,0,1,0" /> 
    <Setter TargetName="OuterBorder" Property="CornerRadius" Value="0" />
    <Setter TargetName="InnerBorder" Property="CornerRadius" Value="0" />
</Trigger>

I edited the line :

<Setter TargetName="OuterBorder" Property="BorderThickness" Value="0,0,1,0" /> 

To :

<Setter TargetName="OuterBorder" Property="BorderThickness" Value="0,0,0,0" /> 

Alternatively you could just remove the whole trigger.

NB: Mine was in the Generic.xaml in the Themes folder for the ControlsLibrary project, which had the folowing at the top

<!--=================================================================
Copyright (C) Microsoft Corporation.  All rights reserved.

This file was generated from individual xaml files found
   in wcp\themes\xaml\, please do not edit it directly.

To generate this file, bcz in Wcp\Themes\Generator and copy 
   the generated theme files from the output directory to
   the corresponding themes\ folder.

To automatically copy the files, set the environment variable
   set THEMEXAML_AUTOUPDATE=1

==================================================================-->

So you may want to make a copy or regenerate.

Upvotes: 1

Sheridan
Sheridan

Reputation: 69959

I don't have any vertical lines between the Buttons in my RibbonControl, just between the various RibbonGroups... can you show us a screen shot of it?

As I can't see these lines, I'm not sure that this will work, but you can try adding a Style like this into the Resources section of your RibbonGroup:

<Style TargetType="{x:Type Ribbon:RibbonSeparator}">
    <Setter Property="Visibility" Value="Collapsed" />
</Style>

I normally use something like this for the lines between the RibbonGroup objects, but not between the Buttons, but it might work.

Upvotes: 0

Related Questions