qr code c# source Defining a Ribbon group template in C#.NET

Create QR Code ISO/IEC18004 in C#.NET Defining a Ribbon group template

Listing 10.9 Defining a Ribbon group template
QR-Code Maker In C#
Using Barcode printer for Visual Studio .NET Control to generate, create QR image in Visual Studio .NET applications.
www.OnBarcode.com
QR Code Recognizer In Visual C#
Using Barcode decoder for .NET framework Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
<GroupTemplate Id="Ribbon.Templates.RSSTemplates" > <Layout Title="RSSTemplate1" LayoutTitle="RSSTemplate1" > <Section Alignment="Top"
Drawing DataMatrix In C#
Using Barcode generator for Visual Studio .NET Control to generate, create Data Matrix ECC200 image in Visual Studio .NET applications.
www.OnBarcode.com
PDF 417 Encoder In Visual C#
Using Barcode encoder for VS .NET Control to generate, create PDF417 image in Visual Studio .NET applications.
www.OnBarcode.com
Used by the Group element
Creating Code128 In Visual C#.NET
Using Barcode drawer for VS .NET Control to generate, create Code128 image in .NET framework applications.
www.OnBarcode.com
EAN 13 Generator In Visual C#.NET
Using Barcode drawer for .NET framework Control to generate, create EAN / UCC - 13 image in .NET applications.
www.OnBarcode.com
Used by Size attribute in scaling
Barcode Drawer In C#.NET
Using Barcode printer for VS .NET Control to generate, create Barcode image in Visual Studio .NET applications.
www.OnBarcode.com
Draw USPS Confirm Service Barcode In C#
Using Barcode maker for VS .NET Control to generate, create Planet image in Visual Studio .NET applications.
www.OnBarcode.com
Dynamic interfaces in Web Parts
Create QR Code JIS X 0510 In VS .NET
Using Barcode generator for Reporting Service Control to generate, create Denso QR Bar Code image in Reporting Service applications.
www.OnBarcode.com
Scanning QR-Code In C#
Using Barcode recognizer for VS .NET Control to read, scan read, scan image in .NET applications.
www.OnBarcode.com
Type="OneRow" > <Row> <ControlRef DisplayMode="Large" TemplateAlias="ctrl1" /> </Row> </Section> </Layout> </GroupTemplate>
Data Matrix ECC200 Drawer In Java
Using Barcode generator for Android Control to generate, create ECC200 image in Android applications.
www.OnBarcode.com
Recognize GS1-128 In C#.NET
Using Barcode recognizer for .NET Control to read, scan read, scan image in .NET applications.
www.OnBarcode.com
Used by controls
UPC-A Encoder In None
Using Barcode creator for Software Control to generate, create Universal Product Code version A image in Software applications.
www.OnBarcode.com
Read GS1 - 12 In C#
Using Barcode scanner for Visual Studio .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Each template is contained in a GroupTemplate element that has an id B that s used by the Template attribute on the Group element in listing 10.8. There can be multiple Layout elements where each has a unique LayoutTitle C attribute that s used by the scaling elements (Scale and MaxSize). The Layout contains sections that have Rows or Strips. A Row or a Strip contains ControlRef elements, which are placeholders for the controls. Each ControlRef element has a DisplayMode that determines the layout of the control. You have to pay attention to which DisplayMode is used with which control. Not all controls support all display modes. The TemplateAlias D attribute specifies the name of the control reference and is used by the controls in the Ribbon.
Paint ANSI/AIM Code 128 In Java
Using Barcode printer for BIRT Control to generate, create ANSI/AIM Code 128 image in Eclipse BIRT applications.
www.OnBarcode.com
Generate PDF 417 In Java
Using Barcode creator for Java Control to generate, create PDF417 image in Java applications.
www.OnBarcode.com
NOTE
Encoding Barcode In Java
Using Barcode drawer for Java Control to generate, create Barcode image in Java applications.
www.OnBarcode.com
Scan EAN-13 In .NET Framework
Using Barcode reader for .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
You should always create your own group templates and not reference templates from other projects or the out-of the box Ribbon. This will ensure that the template is loaded when referenced by your controls.
Barcode Drawer In None
Using Barcode drawer for Microsoft Excel Control to generate, create Barcode image in Office Excel applications.
www.OnBarcode.com
EAN 128 Generator In None
Using Barcode creation for Excel Control to generate, create GS1-128 image in Office Excel applications.
www.OnBarcode.com
The last part of the Ribbon XML defines the action that s executed when a user clicks the button. For simple actions, this can be defined in XML, but for more advanced operations a custom Page Component JavaScript is needed, as you ll see in the next sample. The command is defined as follows and the CommandUIHandler elements are placed in the CommandUIHandlers element in listing 10.7:
<CommandUIHandler Command="WebPartsInAction.RefreshCommand" CommandAction="javascript:feeds.refreshAll()"/>
Each CommandUIHandler has a Command attribute that contains the name referenced by the Command attribute of the control. The CommandAction attribute defines the command to be executed. In this case it invokes a JavaScript method. The JavaScript method is added to the JavaScript namespace that you created earlier:
refreshAll: function () { SP.UI.Notify.addNotification('Refreshing feeds...'); $(".feedWebPart div:first").each(function () { __doPostBack($(this)[0].id, ''); }); }
The method will display a notification message and then use jQuery to find all elements that have the CSS class feedWebPart and then the first div in that HTML element. Using the id of each of those div elements, it ll make a partial update. To add
Enabling a Web Part to use the Ribbon
the CSS class to the RSS Feed Web Part, add the following to the CreateChildControls method of the Web Part:
this.CssClass = "feedWebPart";
There s one more thing to do before you can see the Ribbon: configure the Web Part to show the Ribbon when it s added to a page. In the CreateChildControls method, add the following:
SPRibbon current = SPRibbon.GetCurrent(this.Page); if (current != null) { current.CommandUIVisible = true; current.MakeTabAvailable("WebPartsInAction.RssTab"); }
This code retrieves the current instance of the Ribbon. If the Ribbon is available, the code will make sure that the Ribbon is visible and then make our RSS Feed tab available. The MakeTabAvailable method requires that the Microsoft.Web.CommandUI. dll be added as a reference to the project. This assembly is found in {SharePoint Root}\ISAPI. Now you re all set to build and deploy. Add two or more RSS Web Parts to a page and configure them. Click the Refresh Feeds button in the custom Ribbon tab and watch the times in the Web Parts change. You can use the same method to add Ribbon customizations to a page using delegate controls, traditional server or user controls, or even add Ribbon controls directly to a custom page. Ribbon customizations aren t specific to Web Parts. In the next sample, you ll look at a Ribbon customization that s for Web Parts only.
Full reference of the Server Ribbon Schema can be found in the SharePoint 2010 SDK at the Microsoft MSDN site: http://msdn.microsoft.com/ library/ff458369.aspx. The default Ribbon in SharePoint 2010 is defined in the CMDUI.XML file, located in {SharePoint Root}\Template\Global\Xml. I suggest you look at that one to get inspiration and ideas for your own Ribbon customizations.
10.3.2 Making a Web Part context aware The previous sample added a custom Ribbon tab to a page when a Web Part appeared on the page. This customization was quite generic and not only applicable to Web Parts. But what if you d like to add to the Ribbon a custom tab that s tied to a Web Part That way, when the Web Part is selected the Ribbon extensions become available. This is called a context-aware Web Part and is used, for instance, by the Media Web Part in SharePoint 2010 Server. When that Web Part is selected, the media options appear in the Ribbon. I ll show you how to make the RSS Web Part context aware. When the Web Part is selected, a new contextual Ribbon tab will appear and allow you to edit the feed URL from the Ribbon instead of using the Editor Part. The Ribbon XML is built in much the same way as the previous approach, with just a few changes. The JavaScript is more
Copyright © OnBarcode.com . All rights reserved.