4

Here is my custom ribbon tab definition:

  <CustomAction
           Id="CustomRibbonTab"
           Location="CommandUI.Ribbon">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.Tabs._children">
          <Tab
            Id="Ribbon.CustomTab"
            Title="Custom Tab"
            Description="Custom Tab !!!"
            Sequence="501">
            <Scaling
              Id="Ribbon.CustomTab.Scaling">
              <MaxSize
                Id="Ribbon.CustomTab.MaxSize"
                GroupId="Ribbon.CustomTab.CustomGroup"
                Size="OneLargeTwoMedium"/>
              <Scale
                Id="Ribbon.CustomTab.Scaling.CustomTabScaling"
                GroupId="Ribbon.CustomTab.CustomGroup"
                Size="OneLargeTwoMedium" />
            </Scaling>
            <Groups Id="Ribbon.CustomTab.Groups">
              <Group
                Id="Ribbon.CustomTab.CustomGroup"
                Description="Custom Group!"
                Title="Custom Group"
                Sequence="52"
                Template="Ribbon.Templates.CustomTemplate">
                <Controls Id="Ribbon.CustomTab.CustomGroup.Controls">
                  <Button
                    Id="Ribbon.CustomTab.CustomGroup.CustomButton"
                    Command="CustomTab.CustomButtonCommand"
                    Sequence="15"
                    Description=""
                    LabelText="Custom Button"
                    Image32by32="/_layouts/images/PPEOPLE.GIF"
                    TemplateAlias="cust1"/>

                </Controls>
              </Group>
            </Groups>
          </Tab>
        </CommandUIDefinition>
        <CommandUIDefinition Location="Ribbon.Templates._children">
          <GroupTemplate Id="Ribbon.Templates.CustomTemplate">
            <Layout
              Title="OneLargeTwoMedium"
              LayoutTitle="OneLargeTwoMedium">
              <Section Alignment="Top" Type="OneRow">
                <Row>
                  <ControlRef DisplayMode="Large" TemplateAlias="cust1" />
                </Row>
              </Section>
            </Layout>
          </GroupTemplate>
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
          Command="CustomTab.CustomButtonCommand"
           CommandAction="javascript:alert('Hello, world!');" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>

I didn't use RegistrationId and RegistrationType on the element because I am making the tab visible with a delegate control.

When the page loads, the tab becomes visible between Browse and Page tabs but when I click the tab title, the contents of the tab don't appear. Instead the Loading animation loops forever.

EDIT: Also when I click one of the other tabs before I click the custom tab, the tab disappears completely.

Any help is appreciated, thanks.

2

One great way to troubleshoot Ribbon customizations is to open up Internet Explorer Development Tools (preferably the ones in IE9) and then check the script console, most errors are reported there (sometimes with weird error messages though).

I also normally use Fiddler to see what Ribbon custommizations is retrieved (they are downloaded asynchronous).

And the third troubleshoting option is to open up IE in InPrivate browsing mode, so nothing gets cached. To be on the safe side, close and reopen IE InPrivate between each change you do to your customizations.

  • +1 on closing and reopening IE in InPrivate for caching. A real pain to develop. – Bart Jan 5 '12 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.