共用方式為


Define scaling for ribbon elements

 

Applies To: Dynamics CRM 2013

For application ribbons and updated entity form ribbons there is no scaling. Scaling only applies to forms for entities that weren’t updated and list ribbons displayed using Microsoft Dynamics CRM 2013 for Microsoft Office Outlook.

The goal of the Ribbon is to maintain visibility of relevant controls even when the horizontal size of the window changes. To achieve this, the UI definition allows you to control how controls in a group change size in response to changes in the size of the window. This is known as scaling.

Associate groups and controls to layout templates

Each <Group> (RibbonDiffXml) element in the ribbon is associated with a <GroupTemplate> (RibbonDiffXml). The GroupTemplate specifies one or more ways the controls in the group can be presented using <Layout> (RibbonDiffXml) elements. Each Layout may contain one of two types of definition for how the controls in the group are displayed.

Almost all the Layout elements used in ribbons use OverflowSection elements.

Each <Tab> (RibbonDiffXml) element must contain one <MaxSize> (RibbonDiffXml) in the <Scaling> (RibbonDiffXml). The MaxSize element is required because it establishes the default presentation of each Group in a Tab without any scaling applied. Scaling occurs when a Tab is associated with one or more <Scale> (RibbonDiffXml). Each MaxSize and Scale element is associated via the Size attribute with one of the Layout elements in the GroupTemplate used by each Group within a Tab.

Note

The value of the Size attribute of any MaxSize or Scale element must match the Title of the available Layout elements specified in the GroupTemplate. These values are strings and there is no validation in the XSD to help you select values that are a match. The XML is always case-sensitive.

The following diagram shows how MaxSize, Scale, Group, Layout and OverflowSection elements must reference each other to enable scaling when you are using a <OverflowSection> (RibbonDiffXml) element.

Element relationships with OverflowSection

The following diagram shows how MaxSize, Scale, Group, Layout and ControlRef elements must reference each other to enable scaling when you are using a <Section> (RibbonDiffXml) element.

Element Relationships with Section

Use existing group templates

When creating a new group, instead of defining new group templates, you can re-use existing GroupTemplate elements.

Associate your new group to that template. For each control in the group, use a TemplateAlias value from one of the <Section> (RibbonDiffXml) or <OverflowSection> (RibbonDiffXml) elements found in one of the Layout elements used by that GroupTemplate. Each <OverflowSection> (RibbonDiffXml) includes an isv TemplateAlias that is not used by Microsoft Dynamics CRM. This TemplateAlias is provided to allow ISVs to add controls to that group.

Control how scaling is applied

Each Scale element in the Scaling element for a particular tab represents one scale step. Each Scale is applied sequentially by the order in which the Scale element appears. When reducing the horizontal space available for the ribbon, each scale element is applied in order from top down. When increasing the horizontal space available, from the smallest space the bottom scale element is in effect. Each of the available Scale elements are applied in order from the bottom to the top until all the MaxSize elements are in effect.

Note

The Scale element Sequence attribute values aren’t used to determine the order in which scaling is applied. Scaling is applied by the relative order the MaxSize and Scale elements appear in the RibbonDiffXML. The Sequence value is important for both MaxSize and Scale elements because all the MaxSize elements must be grouped together above the Scale elements. When you add new MaxSize or Scale elements, be sure that you review the Sequence default value ranges assigned to all the MaxSize elements and the Scale elements. A common error is to assign Sequence values that could cause the ranges to overlap.

See Also

Customize commands and the ribbon
Define custom actions to modify the ribbon
Define ribbon tab display rules