How to Modify RibbonControl Items and Properties in DiagramDesignerControl

  • 2 minutes to read

There are several ways to customize the built-in RibbonControl:

  • Use the RibbonControl's Merging feature. Create an external RibbonControl with required elements and attach the MergingProperties.ElementMergingBehavior property to DiagramDesignerControl. After performing this, elements form the DiagramDesignerControl's ribbon will be merged with the parent ribbon.
  • Customization actions. Using customization actions, you can create/remove/update bar items. Use the DiagramDesignerControl.Actions property to define customization actions. The DefaultBarItemNames class contains default item captions displayed in the diagram's Ribbon. The DefaultBarItemNames document describes how the members of this class correspond to the Ribbon's elements.
  • Overriding theme styles. Almost all bar items in DiagramDesignerControl have styles defined as DynamicResource. You can override these styles and set required properties in them. To learn more about modifying our theme resources, refer to How to modify DX themes in WPF.

    <Style x:Key="{dxdiagt:DesignerControlCommandsThemeKeys ResourceKey=PasteCommandItemStyle, IsThemeIndependent=True}" TargetType="{x:Type dxb:BarButtonItem}">
            <Setter Property="Content" Value="Custom Paste"/>
            <Setter Property="Glyph" Value="{dx:DXImage Image=GlobalColorScheme_16x16.png}"/>
            <Setter Property="LargeGlyph" Value="{dx:DXImage Image=GlobalColorScheme_32x32.png}"/>
            <Setter Property="Command" Value="{Binding Commands.Paste, RelativeSource={RelativeSource TemplatedParent}}"/>