如何在 Tridion 的功能区中水平地创建一个在另一个下方的自定义按钮 [英] How to create the custom buttons horizontally one below the other in ribbon of Tridion

查看:19
本文介绍了如何在 Tridion 的功能区中水平地创建一个在另一个下方的自定义按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 tridion 功能区中水平放置多个自定义按钮 - 一个在另一个下方.

How to place more than one custom buttons horizontally - one below the other in tridion ribbon.

就像我们有签入、签出、撤消签出按钮一样.

Like we have Check-in, Check-out, Undo Check-out buttons.

我尝试通过将它们放在一组中来创建多个自定义按钮,但默认情况下它们并排对齐,而不是一个在另一个下方.

I tried in creating more than one custom buttons by placing them in a group, but by default they were getting aligned side-by-side but not one below the other.

推荐答案

我关于 Tridion Developer 的一篇文章 我解释了如何使用 Ribbon Item Group,它可以将小按钮放在一起,这样您就可以在 2 个大按钮(彼此相邻)的空间中放置 3 个按钮.

In one of my articles on Tridion Developer I explained all about how to use the Ribbon Item Group, this fits small buttons under each other, so that you can place 3 buttons in the space of 2 large ones (which are next to each other).

RibbonItemGroup 不是您可以在 UI 扩展的配置文件中定义的内容,它是您需要指定的 Tridion 用户控件 (.ascx).

The RibbonItemGroup is not something you can define in the Configuration file of your UI extension, it is a Tridion User Control (.ascx) that you need to specify.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ViewItemsGroup.ascx.cs" Inherits="SDL.Examples.UI.Controls.ViewItemsGroup" %>
<%@ Import Namespace="Tridion.Web.UI" %>
<c:RibbonItemsGroup runat="server" ID="RibbonItemsGroup">
  <c:RibbonButton runat="server" CommandName="ViewStaging" Title="View in Staging" Label="View In Staging" IsSmallButton="true" ID="ViewStagingBtn" />
  <c:RibbonButton runat="server" CommandName="ViewLive" Title="View in Live" Label="View in Live" IsSmallButton="true" ID="ViewLiveBtn" />
</c:RibbonItemsGroup>

文件背后的代码扩展了 Tridion.Web.UI.Controls.TridionUserControl,不需要任何特定代码.要将其包含在功能区工具栏中,请使用配置文件中的以下 XML 将功能区项目组指定为扩展:

The code behind file extends a Tridion.Web.UI.Controls.TridionUserControl and doesn’t need any specific code. To include it in the Ribbon toolbar, you specify the Ribbon Items Group as an extension using the following XML in your Configuration file:

<ext:extension assignid="ViewItemsGroup" groupid="EditGroup" name="View" pageid="HomePage" insertbefore="PublishGroup">
  <ext:group>~/Controls/ViewItemsGroup.ascx</ext:group>
  <ext:dependencies>
    <cfg:dependency>My.Theme</cfg:dependency>
    <cfg:dependency>My.Commands</cfg:dependency>
  </ext:dependencies>
  <ext:apply>
    <ext:view name="DashboardView">
      <ext:control id="DashboardToolbar" />
    </ext:view>
    <ext:view name="PageView">
      <ext:control id="ItemToolbar" />
    </ext:view>
  </ext:apply>
</ext:extension>

这篇关于如何在 Tridion 的功能区中水平地创建一个在另一个下方的自定义按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆