Using standard icons in your definitions |
OOTB SharePoint Ribbon icons are availiable for custom ribbons too. This article describes, how this can be done.
Standard Ribbon icons are contained in two image sheets: formatmap32x32.png and formatmap16x16.png. They both contain similar images in different resolutions: 32x32 and 16x16 respectivly.
You can examine these images in your SharePoint environment. Simply navigate to '/_layouts/1033/images/formatmap32x32.png' address inside your SharePoint portal.
You will see the following picture:
FluentRibbon simplifies work with standard images. You can use ImageLibraryGetStandardImage to get standard icon with specified coordinates. Coordinates are starting from zero, and binded to icon sequence inside the composite image.
For example, to get 'Undo' icon, you should pass X=3 and Y=13 to GetStandardImage.
new ButtonDefinition() { Id = "Undo", Title = "Undo last move", CommandJavaScript = "Gb();", Image = ImageLibrary.GetStandardImage(3, 13) }
Files formatmap32x32.png and formatmap16x16.png in localized SharePoint environments need to be referenced respecting the current locale. You can use ImageLibraryGetStandardImage overload for this purpose, providing locale ID as the last parameter.
For example, if you have SPWeb object in the web variable, you can respect localization by using following code:
new ButtonDefinition() { Id = "Undo", Title = "Undo last move", CommandJavaScript = "Gb();", Image = ImageLibrary.GetStandardImage(3, 13, web.Locale.ID) }