Gallery Sample

This code sample demonstrates the markup and code required to use the different types of Gallery controls included in the Windows Ribbon framework. The sample includes code that can be used to dynamically populate items into the Galleries, and handle special Gallery previewing events that support results-oriented UI.


The Gallery Sample can be downloaded as a standalone Microsoft Visual Studio project from the Microsoft Download Center or installed as part of the Windows Software Development Kit (SDK).

  • Microsoft Download Center: Windows Ribbon Samples
  • Windows Software Development Kit (SDK) (standard installation path): %ProgramFiles%\Microsoft SDKs\Windows\[version number]\Samples\winui\WindowsRibbon\Gallery

Building the Sample

Download the sample to your hard disk.

Install the Windows SDK for Windows 7 and open its build environment command window. On the Start menu, point to All Programs, Microsoft Windows SDK, and then click CMD Shell.

To build the sample from the build environment command window, go to the source directory of the sample. At the command prompt, type MSBUILD.

To build the sample in Microsoft Visual Studio, load the sample solution or project file and then press CTRL+SHIFT+B.

Running the Sample

To run the sample from the build environment command window, execute the .exe files in the Bin\Debug or Bin\Release folder contained in the sample source folder.

To run the compiled sample with debugging in Visual Studio, press F5.


The Windows Ribbon Development Forum is available to discuss topics and ask questions related to developing Windows Ribbon applications.

Minimum Requirements

Minimum supported client

Windows 7

Windows Vista with Service Pack 2 (SP2) and Platform Update for Windows Vista

Minimum supported server

Windows Server 2008 R2

Windows Server 2008 with SP2 and Platform Update for Windows Server 2008

Windows SDK 7.0
Visual Studio 2008
Header and IDL files uiribbon.h, uiribbon.idl


Note  The Platform Update for Windows Vista and Platform Update for Windows Server 2008 are sets of run-time libraries that enable developers to target Windows Ribbon applications to both Windows Vista and Windows Server 2008. The platform updates will be available to all Windows Vista and Windows Server 2008 customers through Windows Update. Third-party applications that require Platform Update for Windows Vista or Platform Update for Windows Server 2008 can have Windows Update detect whether the required updated is installed; if it is not, Windows Update will download and install it in the background.

Related topics

Working with Galleries
Combo Box
Drop-Down Gallery
In-Ribbon Gallery
Split Button Gallery
Collection Properties