Click or drag to resize
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 SharePoint Ribbon icons

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:

formatmap 32x 32
Accessing standard icons from Fluent Ribbon

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.

C#
new ButtonDefinition()
{
    Id = "Undo",
    Title = "Undo last move",
    CommandJavaScript = "Gb();",
    Image = ImageLibrary.GetStandardImage(3, 13)
}
Using standard images in localized SharePoint environments

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:

C#
new ButtonDefinition()
{
    Id = "Undo",
    Title = "Undo last move",
    CommandJavaScript = "Gb();",
    Image = ImageLibrary.GetStandardImage(3, 13, web.Locale.ID)
}