<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.microsoft.co.il/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Arik Poznanski&amp;#39;s Blog : Windows 7</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx</link><description>Tags: Windows 7</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Using Windows Phone As Windows 7 Accelerometer Sensor</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/08/13/using_2D00_windows_2D00_phone_2D00_as_2D00_windows_2D00_7_2D00_accelerometer_2D00_sensor.aspx</link><pubDate>Sat, 13 Aug 2011 15:54:20 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:883702</guid><dc:creator>arik</dc:creator><slash:comments>191</slash:comments><description>&lt;p&gt;I just had a cool idea! (actually I had it like 6 month ago, but bear with me).&lt;/p&gt;  &lt;p&gt;My idea involves mixing some of the features in Windows 7 with some of the features in Windows Phone 7, to create a glorious mix!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_6105F6E1.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_25DE2CE4.png" width="640" height="382" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Windows 7&lt;/h3&gt;  &lt;p&gt;One of the new features in Windows 7 is the &lt;a href="http://msdn.microsoft.com/en-us/library/dd318953(VS.85).aspx"&gt;Sensor API&lt;/a&gt; which provides a standard interface for accessing sensors of various types, like &lt;font style="background-color:#ffff00;"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;strong&gt;accelerometer&lt;/strong&gt;&lt;font style="background-color:#ffff00;"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;, etc..&lt;/p&gt;  &lt;p&gt;I &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2010/06/29/using-windows-7-light-sensor-in-your-application.aspx"&gt;wrote&lt;/a&gt; in the past about how you can consume this API from a C# application using &lt;a href="http://code.msdn.microsoft.com/WindowsAPICodePack"&gt;Windows API Code Pack&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Windows Phone 7&lt;/h3&gt;  &lt;p&gt;Windows Phone 7 comes with a few sensors out of the box, among them: &lt;strong&gt;&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;strong&gt;accelerometer!&lt;/strong&gt;&lt;strong&gt;&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Idea&lt;/h3&gt;  &lt;p&gt;What if we use Windows Phone 7 accelerometer sensor as a standard device on Windows 7?&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Roadmap&lt;/h3&gt;  &lt;p&gt;So how can we accomplish that? let&amp;#39;s break the idea to steps:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Step 1&lt;/u&gt;: Create a software driver &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;I’ll start with creating a dummy software driver. This driver will implement what&amp;#39;s necessary to be a standard Windows 7 Accelerometer sensor, but at this stage will simply return constant data.&lt;/p&gt;  &lt;p&gt;In order to write a sensor driver for Windows 7 I’ll need to use &lt;a href="http://www.microsoft.com/whdc/driver/wdf/umdf.mspx"&gt;User Mode Driver Framework&lt;/a&gt; (UMDF), a COM-like, C++ framework for writing user-mode drivers in Windows 7.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Step 2&lt;/u&gt;: Transfer Windows Phone 7 sensor data into the PC&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The next step is to find a way to transfer the accelerometer data from a Windows Phone device into the PC. One possible way of doing this implementing a local WCF service on the desktop that the Phone will keep calling with accelerometer data. This will require an application to run on the phone to keep the data flowing.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Step 3&lt;/u&gt;: Consume the WCF service from the phone&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Using the service from the previous step we can now consume it in a simple Windows Phone application that all it does is getting the accelerometer sensor data using the phone API and call the WCF service with the latest data.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Step 4&lt;/u&gt;: Make the software driver consume the Windows Phone 7 data&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Now that I have a software driver that returns dummy accelerometer data and a way to get real accelerometer data from the Windows Phone, all I need to do is connecting the dots and make my accelerometer driver return the real data. To do this I&amp;#39;ll need some kind of inter process communication to transfer the data from the WCF service to the driver.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Long Story Short…&lt;/h3&gt;  &lt;p&gt;I present to you the &lt;strong&gt;Windows Phone Accelerometer Driver for Windows 7&lt;/strong&gt;!&lt;/p&gt;  &lt;p&gt;The full source code for this project can be found on the &lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;&lt;a href="http://wp7accelerometer.codeplex.com/"&gt;CodePlex project site&lt;/a&gt;&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Some Implementation Details&lt;/h3&gt;  &lt;p&gt;The actual driver was fairly easy to implement since I used the CodeProject article &amp;quot;&lt;a href="http://www.codeproject.com/KB/system/wiisensor.aspx"&gt;Writing a Sensor Driver for the Wiimote on Windows 7&lt;/a&gt;&amp;quot; by &lt;a href="http://blogorama.nerdworks.in/entry-WritingasensordriverfortheWiim.aspx"&gt;Rajasekharan Vengalil&lt;/a&gt; as a base for my Windows Phone 7 driver. You can find the driver source code in the project named &lt;strong&gt;WP7AccelerometerDriver&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;As mentioned earlier I&amp;#39;ve implemented a simple local WCF service for transferring the accelerometer data from the phone to the driver. You can find the service source code in the project named &lt;strong&gt;WP7AccelerometerService&lt;/strong&gt;. The service uses named pipes to communicate with the driver.&lt;/p&gt;  &lt;p&gt;The phone application is a very simple one that consumes the WCF service and call it whenever a new accelerometer value is available. You can find its source code in the project named &lt;strong&gt;WP7AccelerometerClient&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;Finally, if you want to check the functionality of the accelerometer driver you can use either the &lt;strong&gt;SensorDiagnostics &lt;/strong&gt;project or the more fun &lt;strong&gt;PlaneDemo&lt;/strong&gt; project, which I borrowed for &lt;a href="http://weblogs.asp.net/sergeyzwezdin/archive/2009/07/01/windows-7-sensor-and-location-platform-sensors-programming-part-2-3.aspx"&gt;Sergey Zwezdin blog&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;How to Install?&lt;/h3&gt;  &lt;p&gt;1. Download and extract project binaries or source from the &lt;a href="http://wp7accelerometer.codeplex.com/releases/view/71672"&gt;CodePlex project site&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;2. Open &lt;strong&gt;CMD&lt;/strong&gt; &lt;u&gt;as administrator &lt;/u&gt;&lt;/p&gt;  &lt;p&gt;3. Go to the folder &lt;strong&gt;\Driver\Install\&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;4. According to the bitness of your OS Run &lt;strong&gt;install_wp7_driver_32bit.bat &lt;/strong&gt;or &lt;strong&gt;install_wp7_driver_64bit.bat&lt;/strong&gt; to install the driver. &lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_25322462.png"&gt;     &lt;br /&gt;      &lt;br /&gt;&lt;/a&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_25322462.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_71799236.png" width="600" height="490" /&gt;&lt;/a&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;5. When the following notification appears, select &amp;quot;&lt;strong&gt;Install this driver software anyway&lt;/strong&gt;&amp;quot;: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image11_1F04C4AD.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image11_thumb_250BC5AE.png" width="600" height="344" /&gt;&lt;/a&gt;     &lt;br /&gt;This should take around 1-2 minutes to complete. &lt;/p&gt;  &lt;p&gt;6. Enable installed Sensor in the &lt;strong&gt;Control Panel&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_5B6F12A5.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_18336EAB.png" width="600" height="374" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;7. Run the WCF service from &lt;u&gt;as administrator&lt;/u&gt;. If you run it from Visual Studio, make sure you ran Visual Studio as administrator.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_7191B5D2.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_7B963130.png" width="600" height="135" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;8. Run the Windows Phone client on a real device while connected to the PC and enter your PC (LAN) IP &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_574126E1.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_23F4C7AB.png" width="330" height="600" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;9. That&amp;#39;s it! you can now sit back and enjoy the ride using the &lt;strong&gt;PlaneDemo&lt;/strong&gt; application or &lt;strong&gt;SensorDiagnostics&lt;/strong&gt;, or any other software that uses the accelerometer sensor. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_0DAE868C.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_7E8781E4.png" width="500" height="600" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_6EF44A48.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_05C2F5F8.png" width="600" height="400" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;How to Uninstall? &lt;/h3&gt;  &lt;p&gt;If you want to uninstall the driver simply go to the &lt;strong&gt;Device Manager&lt;/strong&gt;, select the &amp;quot;&lt;strong&gt;WP7 Accelerometer Sensor&lt;/strong&gt;&amp;quot; device from the &lt;strong&gt;Sensors &lt;/strong&gt;category, select uninstall from the context menu and &lt;strong&gt;make sure you mark the checkbox to delete the driver&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_32C7BCF9.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_1B005FC6.png" width="466" height="287" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Final Note&lt;/h3&gt;  &lt;p&gt;I&amp;#39;ve seen the project works both on a real device and using the phone emulator, however it&amp;#39;s not a one-click install. I expect users to have problems with the installation. If you encounter some problems, please post on the &lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;&lt;a href="http://wp7accelerometer.codeplex.com/discussions"&gt;CodePlex project site forum&lt;/a&gt;&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt; page and I&amp;#39;ll do my best to help. &lt;/p&gt;  &lt;p&gt;Also, if you want to improve the source code (maybe adding GPS support?) or the installation procedure, I&amp;#39;ll be happy to include your improvements and even include you as one of the project members on CodePlex.&lt;/p&gt;  &lt;p&gt;This project was pure fun since it combines many useful technologies to create real value. Among the technologies you can find: C++, COM, UMDF, C#, WCF, WP7, etc..&lt;/p&gt;  &lt;p&gt;That&amp;#39;s it for now,    &lt;br /&gt;Arik Poznanski.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/08/13/using_2D00_windows_2D00_phone_2D00_as_2D00_windows_2D00_7_2D00_accelerometer_2D00_sensor.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/08/13/using_2D00_windows_2D00_phone_2D00_as_2D00_windows_2D00_7_2D00_accelerometer_2D00_sensor.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/08/13/using_2D00_windows_2D00_phone_2D00_as_2D00_windows_2D00_7_2D00_accelerometer_2D00_sensor.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/08/13/using_2D00_windows_2D00_phone_2D00_as_2D00_windows_2D00_7_2D00_accelerometer_2D00_sensor.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=172641" rel="tag" style="display:none;"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=883702" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/COM/default.aspx">COM</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/CodePlex/default.aspx">CodePlex</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Accelerometer/default.aspx">Accelerometer</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/UMDF/default.aspx">UMDF</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Driver/default.aspx">Driver</category></item><item><title>Windows Ribbon for WinForms: FAQ</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/07/06/windows-ribbon-for-winforms-faq.aspx</link><pubDate>Wed, 06 Jul 2011 05:46:56 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:849678</guid><dc:creator>arik</dc:creator><slash:comments>8</slash:comments><description>&lt;div class="wlWriterHeaderFooter" style="float:none;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;iframe src="http://www.facebook.com/widgets/like.php?href=http://blogs.microsoft.co.il/blogs/arik/archive/2011/07/06/windows-ribbon-for-winforms-faq.aspx" scrolling="no" frameborder="0" style="border:none;width:130px;height:80px;"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;p&gt;While working on the Windows Ribbon Framework I’ve came across many repeating questions from users. So I’ve decided to write a Frequently Asked Questions post regarding the &lt;a href="http://msdn.microsoft.com/en-us/library/dd371191(v=vs.85).aspx"&gt;Windows Ribbon Framework&lt;/a&gt; and its wrapper &lt;a href="http://windowsribbon.codeplex.com/"&gt;Windows Ribbon for WinForms&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The questions were collected from the &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/windowsribbondevelopment/threads"&gt;Windows Ribbon Development forum&lt;/a&gt;, &lt;a href="http://windowsribbon.codeplex.com/discussions"&gt;Windows Ribbon for WinForms Discussions&lt;/a&gt; and from comments posted on &lt;a href="http://blogs.microsoft.co.il/blogs/arik"&gt;my blog&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What are the supported platforms for the Windows Ribbon Framework?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The Windows Ribbon Framework is only supported on:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Windows 7 &lt;/li&gt;    &lt;li&gt;Windows Vista with Service Pack 2 (SP2) and Platform Update for Windows Vista &lt;/li&gt;    &lt;li&gt;Windows Server 2008 R2 &lt;/li&gt;    &lt;li&gt;windows Server 2008 with SP2 and Platform Update for Windows Server 2008 &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Specifically, Windows XP is not supported. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What are the prerequisites for using the Windows Ribbon Framework or the Ribbon for WinForms project?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You need to work on a Windows 7 or Vista machine. And you need to install &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=71DEB800-C591-4F97-A900-BEA146E4FAE1&amp;amp;displaylang=en"&gt;Windows 7 SDK&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Is the Windows Ribbon Framework free?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Yes, it’s free. It comes as part of the operating system (Vista and up).&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What is the licensing of the Windows Ribbon Framework?      &lt;br /&gt;Is the license the same as other Windows controls or it is Office 2007?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Just like Windows common controls, there are no unusual licensing requirements involved when using the Windows Ribbon framework in your applications. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Is it possible to use the Windows Ribbon Framework in WinForms application?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Of course. Simply use the &lt;a href="http://windowsribbon.codeplex.com/"&gt;Windows Ribbon for WinForms&lt;/a&gt; library. The library includes numerous samples in C# and VB.NET.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;How can I use the ribbon in a WPF application?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Well, you can’t. Not using the &lt;a href="http://msdn.microsoft.com/en-us/library/dd371191(v=vs.85).aspx"&gt;Windows Ribbon Framework&lt;/a&gt;. If you need a WPF ribbon check out &lt;a href="http://msdn.microsoft.com/en-us/library/ff799534.aspx"&gt;Microsoft Ribbon for WPF&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;How many ribbon controls are out there?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Lot’s. Windows Ribbon Framework, MFC version, WPF version, Office version, SharePoint version, and many more 3rd party ribbon controls.&lt;/p&gt;  &lt;p&gt;The &amp;quot;Windows Ribbon Framework&amp;quot; is a ribbon control provided with Windows 7 (and Windows Vista via platform update), intended to be used by native C++ developers (WIN32). It is based on COM and has a &lt;a href="http://windowsribbon.codeplex.com/"&gt;.NET WinForms wrapper&lt;/a&gt;.     &lt;br /&gt;The syntax of the ribbon XML is NOT XAML, but similar. (&amp;quot;XAML-like&amp;quot;). &lt;/p&gt;  &lt;p&gt;There is another ribbon control for MFC developers provided with Visual Studio 2008 SP1. This ribbon follows the MFC guidelines. &lt;/p&gt;  &lt;p&gt;There is a version of a &lt;a href="http://msdn.microsoft.com/en-us/library/ff799534.aspx"&gt;WPF Ribbon&lt;/a&gt; control that is provided by Microsoft for WPF developers.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Does Windows Ribbon Framework Support MDI?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The Windows Ribbon Framework does not support MDI windows and so is the ribbon wrapper library.    &lt;br /&gt;A Ribbon framework application must implement a custom MDI mechanism to support MDI functionality.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Can I change the ribbon in runtime? (i.e. add elements, change tabs, etc.)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Yes, you can dynamically add items to a both command and item galleries.    &lt;br /&gt;For more information, see the Working with Galleries topic at &lt;a href="http://msdn.microsoft.com/en-us/library/dd742868(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/dd742868(VS.85).aspx&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;You can change the tabs by using Application Modes as described in the MSDN article at &lt;a href="http://msdn.microsoft.com/en-us/library/dd940486(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/dd940486(VS.85).aspx&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;My ribbon-enabled application crash when I close it. Any suggestions?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Yes, If you close the application by clicking a ribbon button, you are destroying the ribbon, while you use it. This cause the crash.&lt;/p&gt;  &lt;p&gt;Either run the close method using a timer, or don’t close the application using a ribbon button.&lt;/p&gt;  &lt;p&gt;If you are using C++ you can simply use PostMessage instead of SendMessage to post the quit message.&lt;/p&gt;  &lt;p&gt;Check the following blog post for more details: &lt;a title="Crash while closing application that uses Windows Ribbon Framework" href="http://blogs.microsoft.co.il/blogs/arik/archive/2010/04/14/crash-while-closing-application-that-uses-windows-ribbon-framework.aspx"&gt;Crash while closing application that uses Windows Ribbon Framework&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What are the requirements for the ribbon images?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Ribbon images must be in 32bpp BMP file format. no PNG and no 24bpp BMP.    &lt;br /&gt;However they don&amp;#39;t really have a resolution constraint, they have recommendations     &lt;br /&gt;but if you provide images of the wrong size the framework will just resize them to fit.     &lt;br /&gt;To convert your images to 32bpp BMP you can use the tool presented in &lt;a title="How to convert an image to 32 bit BMP" href="http://blogs.microsoft.co.il/blogs/arik/archive/2009/10/04/how-to-convert-an-image-to-32-bit-bmp.aspx"&gt;How to convert an image to 32 bit BMP&lt;/a&gt;.     &lt;br /&gt;You can find more details on working with images in a ribbon application &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2009/10/24/windows-ribbon-for-winforms-part-10-working-with-images.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Where can I find Windows 7 Ribbon XML schema file?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Checkout the UICC.xsd file in the folder: &amp;lt;&amp;lt;C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin&amp;gt;&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Where can I find more details on the Windows Ribbon for WinForms project?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;A: In my blog. I’ve written dozens of blog posts describing the different aspects of the Windows Ribbon Framework and its wrapper library. Find them all here:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Ribbon/default.aspx" href="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Ribbon/default.aspx"&gt;http://blogs.microsoft.co.il/blogs/arik/archive/tags/Ribbon/default.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;That’s it for now,    &lt;br /&gt;Arik Poznanski.&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=849678" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WinForms/default.aspx">WinForms</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7+SDK/default.aspx">Windows 7 SDK</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/CodePlex/default.aspx">CodePlex</category></item><item><title>Ribbon with C++, Post 6: Ribbon Dynamic Structure Capabilities</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/21/ribbon-with-c-post-6-ribbon-dynamic-structure-capabilities.aspx</link><pubDate>Wed, 22 Jun 2011 03:58:01 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:844791</guid><dc:creator>arik</dc:creator><slash:comments>10</slash:comments><description>&lt;p&gt;This is the 6&lt;sup&gt;th&lt;/sup&gt; and last post about using Windows Ribbon Framework features in C++. You can find the previous parts h&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;ere: &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/03/ribbon-with-c-part-1-introduction-to-the-windows-ribbon-framework.aspx"&gt;Part 1&lt;/a&gt;, &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/06/ribbon-with-c-part-2-first-ribbon-enabled-application.aspx"&gt;Part 2&lt;/a&gt;, &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/13/ribbon-with-c-part-3-using-buttons-with-windows-ribbon-framework.aspx"&gt;Part 3&lt;/a&gt;, &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/15/ribbon-with-c-part-4-layout-controls-in-windows-ribbon-framework.aspx"&gt;Part 4&lt;/a&gt; &amp;amp; &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/16/ribbon-with-c-part-5-using-galleries-with-windows-ribbon-framework.aspx"&gt;Part 5&lt;/a&gt;. &lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;In this post we will dive into the ribbon&amp;#39;s dynamic structure capabilities, i.e. we will learn about the different ways to change the structure of the ribbon at runtime.&lt;/p&gt;  &lt;p&gt;Specifically we will learn about &lt;b&gt;Application Modes&lt;/b&gt; and &lt;b&gt;Contextual Tabs&lt;/b&gt;. We will see what are these features, when to use them and how.&lt;/p&gt;  &lt;h3&gt;Application Modes&lt;/h3&gt;  &lt;h4&gt;What is Application Modes?&lt;/h4&gt;  &lt;p&gt;&lt;b&gt;Application Modes&lt;/b&gt; is a feature of the Windows Ribbon Framework that lets you completely change the ribbon according to the current application state.&lt;/p&gt;  &lt;p&gt;This feature is best explained with an example. Consider Microsoft Paint.    &lt;br /&gt;When you open Microsoft Paint you see it in its default &amp;quot;edit mode&amp;quot;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_755C07CE.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_5D94AA9B.png" width="554" height="78" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now, if you choose from the application menu: Print à Print Preview, the entire ribbon changes to the following &amp;quot;print mode&amp;quot;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_6267388A.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_78F96104.png" width="554" height="85" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Notice that in the different application &amp;quot;modes&amp;quot; you have completely different ribbon tabs.&lt;/p&gt;  &lt;p&gt;More generally, applications sometimes have different modes in which they show a different user interface, for example: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Simple mode VS Advanced mode &lt;/li&gt;    &lt;li&gt;Regular editor mode VS Print mode &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The Windows Ribbon Framework supports the change of its ribbon user interface according to the current application mode. In order to use the ribbon application modes you need to:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Set the available application modes for each ribbon item. This is done in design time. &lt;/li&gt;    &lt;li&gt;Set the current application mode. This is done in run time. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;To summarize, &lt;b&gt;Application Modes&lt;/b&gt; is a feature that allows the ribbon to change its UI according to the current application context.&lt;/p&gt;  &lt;h4&gt;Application Modes Remarks&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;You can set up to 32 different application modes, each identified by a number between 0 and 31. &lt;/li&gt;    &lt;li&gt;Application modes can coexist, meaning you can set both &amp;quot;simple&amp;quot; mode and &amp;quot;advanced&amp;quot; mode as active at the same time. Internally the current application modes are represented by a single 32bit variable (which represents a Boolean array of size 32), thus explaining why you can only have 32 modes. &lt;/li&gt;    &lt;li&gt;Mode 0 is the default mode. So if you don’t set the &lt;b&gt;ApplicationModes&lt;/b&gt; attribute, 0 is the default. &lt;/li&gt;    &lt;li&gt;At least one mode should be set at all times. You can’t disable all the modes (the framework will just ignore your last set). &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;How to use Application Modes?&lt;/h4&gt;  &lt;h6&gt;&lt;font style="font-weight:normal;"&gt;Following is an example of an application with two modes: Simple and Advanced. &lt;/font&gt;    &lt;br /&gt;&lt;font style="font-weight:normal;"&gt;The application loads in simple mode. When the &amp;quot;Switch to Advanced&amp;quot; button is pressed the application changes to the advanced mode and as a result the ribbon changes and additional buttons are added. Note that some buttons appear in both simple and advanced modes.&lt;/font&gt;&lt;/h6&gt;  &lt;p&gt;The end result looks like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_264AD108.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_734B1AD3.png" width="553" height="116" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 1: Demo application in simple mode&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_1573008D.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_5096B68B.png" width="553" height="116" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 2: Demo application in advanced mode&lt;/strong&gt;&lt;/p&gt;  &lt;h5&gt;Defining Application Modes in Ribbon Markup&lt;/h5&gt;  &lt;p&gt;Following is how we set the &lt;b&gt;ApplicationModes&lt;/b&gt; attribute on various visual elements:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:189af0ca-cca0-4cf6-89de-65a367d605bb" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;?xml version=&amp;#39;1.0&amp;#39; encoding=&amp;#39;utf-8&amp;#39;?&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;http://schemas.microsoft.com/windows/2009/Ribbon&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Commands&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;?&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Commands&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdTabMain&amp;quot;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#ff0000;"&gt; ApplicationModes&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;0,1&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupCommon&amp;quot;&lt;/span&gt;&lt;br /&gt;                           &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;ThreeButtons&amp;quot;&lt;/span&gt;&lt;br /&gt;                           &lt;span style="color:#ff0000;"&gt; ApplicationModes&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;0,1&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonNew&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonOpen&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonSave&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupSimple&amp;quot;&lt;/span&gt;&lt;br /&gt;                           &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;TwoButtons&amp;quot;&lt;/span&gt;&lt;br /&gt;                           &lt;span style="color:#ff0000;"&gt; ApplicationModes&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;0&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonSwitchToAdvanced&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonMoreA&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupAdvanced&amp;quot;&lt;/span&gt;&lt;br /&gt;                           &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;FourButtons&amp;quot;&lt;/span&gt;&lt;br /&gt;                           &lt;span style="color:#ff0000;"&gt; ApplicationModes&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;1&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonSwitchToSimple&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonMoreA&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonMoreB&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonMoreC&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Note we didn&amp;#39;t specify the commands sections since there is nothing new in this respect.&lt;/p&gt;  &lt;p&gt;In this example we create a tab with 3 groups in it: Common, Simple and Advanced.    &lt;br /&gt;The common group should always appears so we set its &lt;b&gt;ApplicationModes&lt;/b&gt; attribute to “0,1”. The simple group should only appear in simple mode (0). Similarly, the advanced group should only appear in advanced mode (1).     &lt;br /&gt;Note that the tab element should appear in both modes, so you must also set its &lt;b&gt;ApplicationModes&lt;/b&gt; attribute to “0,1”.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;ApplicationModes&lt;/b&gt; can be set on the following elements:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Core tabs (as opposed to contextual tabs, which we will soon review). &lt;/li&gt;    &lt;li&gt;Groups which are children of core tabs. &lt;/li&gt;    &lt;li&gt;Button, SplitButton and DropDownButton but only when those controls are in the application menu. &lt;/li&gt; &lt;/ul&gt;  &lt;h5&gt;Changing the Application Mode at runtime&lt;/h5&gt;  &lt;p&gt;Following is the command handler implementation for the two ribbon buttons, “Switch to Simple” and “Switch to Advanced”; each button changes the current application mode.&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0d5a792f-7709-4bfd-bc2f-c4703c8cf5f9" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;STDMETHODIMP CCommandHandler::Execute(&lt;br /&gt;     UINT nCmdID,&lt;br /&gt;     UI_EXECUTIONVERB verb,&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPERTYKEY* key,&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPVARIANT* ppropvarValue,&lt;br /&gt;     IUISimplePropertySet* pCommandExecutionProperties)&lt;br /&gt; {&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;switch&lt;/span&gt; (nCmdID)&lt;br /&gt;     {&lt;br /&gt;         ?&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; ID_CMD_SWITCH_TO_ADVANCED:&lt;br /&gt;         &lt;span style="color:#008000;"&gt;// set advanced mode&lt;/span&gt;&lt;br /&gt;         g_pFramework-&amp;gt;SetModes(UI_MAKEAPPMODE(1));&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; ID_CMD_SWITCH_TO_SIMPLE:&lt;br /&gt;         &lt;span style="color:#008000;"&gt;// set simple mode&lt;/span&gt;&lt;br /&gt;         g_pFramework-&amp;gt;SetModes(UI_MAKEAPPMODE(0));&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt;     }&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; S_OK;&lt;br /&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The &lt;b&gt;UI_MAKEAPPMODE&lt;/b&gt; macro is just a simple helper that converts an index number to a 32bit integer with the index bit set. It is defined in UIRibbon.h like this:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:74b080f1-69f4-4262-81a4-f8dcee6293a2" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;#define&lt;/span&gt; UI_MAKEAPPMODE(x) (1 &amp;lt;&amp;lt; (x))&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Of course, you can set several modes at the same time. Although in our application it doesn&amp;#39;t make any sense, you can use the following code to set both 0 and 1 application modes:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:8bf19e9d-7e62-489f-a1dc-90f18b7a9f41" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;g_pFramework-&amp;gt;SetModes(UI_MAKEAPPMODE(0) | UI_MAKEAPPMODE(1));&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;h3&gt;Contextual Tabs&lt;/h3&gt;  &lt;h4&gt;What is Contextual Tabs?&lt;/h4&gt;  &lt;p&gt;Contextual tabs are additional tabs that appear when you enable their context.    &lt;br /&gt;For example, in Microsoft Word 2007 / 2010, when you select a table in your document, you get two additional tabs (Design and Layout) that contain commands relevant only to tables. Put another way, the Design and Layout tabs are shown only if the &amp;quot;table context&amp;quot; is available.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_649FAD47.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_175F8DEF.png" width="553" height="198" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 3: Microsoft Word 2010 with two Contextual Tabs: Design and Layout&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;When working with &lt;b&gt;Contextual Tabs&lt;/b&gt; the basic working unit is a &lt;b&gt;TabGroup&lt;/b&gt;, which is a group of contextual tabs with the same context. For example, in figure 3, you can see the tab group named &amp;quot;Table Tools&amp;quot;.&lt;/p&gt;  &lt;p&gt;A &lt;b&gt;TabGroup&lt;/b&gt; has a property named &lt;b&gt;ContextAvailable&lt;/b&gt; (Property Identifier: &lt;b&gt;UI_PKEY_ContextAvailable&lt;/b&gt;) of type UI_&lt;b&gt;CONTEXTAVAILABILITY&lt;/b&gt; which can have the following values:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;UI_CONTEXTAVAILIBILITY_ACTIVE&lt;/b&gt; – Meaning the context is currently available and the tab group should be active (i.e. selected). &lt;/li&gt;    &lt;li&gt;&lt;b&gt;UI_CONTEXTAVAILIBILITY_AVAILABLE&lt;/b&gt; – Meaning the context is currently available (but the tabs are not necessarily active). &lt;/li&gt;    &lt;li&gt;&lt;b&gt;UI_CONTEXTAVAILIBILITY_AVAILABLE&lt;/b&gt; – Meaning the context is currently not available (hence the additional tabs are hidden). &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;How to use Contextual Tabs?&lt;/h4&gt;  &lt;p&gt;Following is an example of an application that uses contextual tabs.    &lt;br /&gt;We define two tabs, &amp;quot;Design&amp;quot; and &amp;quot;Layout&amp;quot; which are in the same tab group.     &lt;br /&gt;In this example the context will be set and unset by pressing the &amp;quot;Select&amp;quot; button and &amp;quot;Unselect&amp;quot; button respectively. Of course, in a real application you should set the context according to a real context change.&lt;/p&gt;  &lt;p&gt;The end result looks like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_708151E1.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_6A96887B.png" width="553" height="124" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 4: Demo application before setting the &amp;quot;Table Tools&amp;quot; context&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_6F69166A.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_7109BC71.png" width="553" height="124" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 5: Demo application after setting the &amp;quot;Table Tools&amp;quot; context&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h5&gt;Defining Contextual Tabs in Ribbon Markup&lt;/h5&gt;  &lt;p&gt;Following is the &lt;i&gt;views &lt;/i&gt;section for defining contextual tabs. The &lt;i&gt;commands&lt;/i&gt; section is straightforward.&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:608b221e-3a12-480e-95d6-1bc6a6728747" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;?xml version=&amp;#39;1.0&amp;#39; encoding=&amp;#39;utf-8&amp;#39;?&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;http://schemas.microsoft.com/windows/2009/Ribbon&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Commands&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;...&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Commands&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.ContextualTabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TabGroup&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdTabGroupTableTools&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdTabDesign&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdGroupDesign&amp;#39;&lt;/span&gt;&lt;br /&gt;                               &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;ThreeButtons&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonDesign1&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonDesign2&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonDesign3&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdTabLayout&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdGroupLayout&amp;#39;&lt;/span&gt;&lt;br /&gt;                               &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;TwoButtons&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonLayout1&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonLayout2&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TabGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.ContextualTabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdTabMain&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupCommon&amp;quot;&lt;/span&gt;&lt;br /&gt;                           &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;FiveButtons&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;...&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonSelect&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonUnselect&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;...&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Note the new &lt;b&gt;Ribbon.ContextualTabs&lt;/b&gt; section, where we define a single &lt;b&gt;TabGroup&lt;/b&gt; for “Table Tools”, with two contextual tabs, “Design” and “Layout”.     &lt;br /&gt;Each tab has some buttons in it.     &lt;br /&gt;In addition we define in the main tab two buttons that we will use to set and unset the “Table Tools” context.&lt;/p&gt;  &lt;h5&gt;Setting Context for Contextual Tabs at Runtime&lt;/h5&gt;  &lt;p&gt;Following is the command handler implementation for the two ribbon buttons, “Select” and “Unselect”; each button changes the availability of the &amp;quot;Table Tools&amp;quot; context.&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:caaffe7c-3d23-49d5-8efb-a861008ea8ea" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;STDMETHODIMP CCommandHandler::Execute(&lt;br /&gt;     UINT nCmdID,&lt;br /&gt;     UI_EXECUTIONVERB verb,&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPERTYKEY* key,&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPVARIANT* ppropvarValue,&lt;br /&gt;     IUISimplePropertySet* pCommandExecutionProperties)&lt;br /&gt; {&lt;br /&gt;     PROPVARIANT varNew;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;switch&lt;/span&gt; (nCmdID)&lt;br /&gt;     {&lt;br /&gt;         ?&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; ID_CMD_SELECT:&lt;br /&gt;             &lt;span style="color:#008000;"&gt;// mark context as active&lt;/span&gt;&lt;br /&gt;             UIInitPropertyFromUInt32(UI_PKEY_ContextAvailable,&lt;br /&gt;                                         UI_CONTEXTAVAILABILITY_ACTIVE, &amp;amp;varNew);&lt;br /&gt;             g_pFramework-&amp;gt;SetUICommandProperty(ID_CMD_TABGROUP_TABLE,&lt;br /&gt;                                         UI_PKEY_ContextAvailable, varNew);&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; ID_CMD_UNSELECT:&lt;br /&gt;             &lt;span style="color:#008000;"&gt;// mark context as not available&lt;/span&gt;&lt;br /&gt;             UIInitPropertyFromUInt32(UI_PKEY_ContextAvailable, &lt;br /&gt;                                         UI_CONTEXTAVAILABILITY_NOTAVAILABLE, &amp;amp;varNew);&lt;br /&gt;             g_pFramework-&amp;gt;SetUICommandProperty(ID_CMD_TABGROUP_TABLE,&lt;br /&gt;                                         UI_PKEY_ContextAvailable, varNew);&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt;     }&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; S_OK;&lt;br /&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;h3&gt;Summary&lt;/h3&gt;  &lt;p&gt;In this post we have learned about the different ways we can use to change the structure of the ribbon at runtime.    &lt;br /&gt;We have seen how to use &lt;b&gt;Application Modes&lt;/b&gt; to completely change the ribbon user interface according to the current application state. We have also seen how to use &lt;b&gt;Contextual Tabs&lt;/b&gt; which enable us to add tabs depending on the current context.&lt;/p&gt;  &lt;p&gt;You can find the full source code of the sample application used in this post &lt;a href="http://blogs.microsoft.co.il/blogs/arik/RibbonPost6Demo.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;That&amp;#39;s it for now,    &lt;br /&gt;Arik Poznanski.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/21/ribbon-with-c-post-6-ribbon-dynamic-structure-capabilities.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/21/ribbon-with-c-post-6-ribbon-dynamic-structure-capabilities.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/21/ribbon-with-c-post-6-ribbon-dynamic-structure-capabilities.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/21/ribbon-with-c-post-6-ribbon-dynamic-structure-capabilities.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=172641" rel="tag" style="display:none;"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=844791" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/COM/default.aspx">COM</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2B002B00_/default.aspx">C++</category></item><item><title>Ribbon with C++, Part 5: Using Galleries with Windows Ribbon Framework</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/16/ribbon-with-c-part-5-using-galleries-with-windows-ribbon-framework.aspx</link><pubDate>Fri, 17 Jun 2011 03:36:44 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:843425</guid><dc:creator>arik</dc:creator><slash:comments>7</slash:comments><description>&lt;p&gt;This is the 5&lt;sup&gt;th&lt;/sup&gt; post about Windows Ribbon Framework features.     &lt;br /&gt;On previous posts we have &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/03/ribbon-with-c-part-1-introduction-to-the-windows-ribbon-framework.aspx"&gt;introduced&lt;/a&gt; the ribbon framework, seen a &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/06/ribbon-with-c-part-2-first-ribbon-enabled-application.aspx"&gt;complete&lt;/a&gt; example, and reviewed how to use &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/13/ribbon-with-c-part-3-using-buttons-with-windows-ribbon-framework.aspx"&gt;buttons&lt;/a&gt;-based UI controls and how to control their &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/15/ribbon-with-c-part-4-layout-controls-in-windows-ribbon-framework.aspx"&gt;layout&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;In this post we continue our exploration of the Windows Ribbon Framework, this time focusing on Gallery controls. &lt;/p&gt;  &lt;p&gt;We will learn what galleries are and what is the difference between an item gallery and a command gallery. We will learn about the different gallery controls: &lt;b&gt;ComboBox&lt;/b&gt;, &lt;b&gt;DropDownGallery&lt;/b&gt;, &lt;b&gt;SplitButtonGallery&lt;/b&gt; and &lt;b&gt;InRibbonGallery&lt;/b&gt;.     &lt;br /&gt;Of course we will see how to set gallery items and how to respond to a user choice.&lt;/p&gt;  &lt;h3&gt;What is a gallery?&lt;/h3&gt;  &lt;p&gt;A gallery is a ribbon UI control which contains a list of elements. The elements in the list are represented by a text caption or an image, and can be organized by categories.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_3EED6D96.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_2223D2B4.png" width="162" height="190" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 1: An example of a gallery&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The galleries that we will soon review comes in two flavors: item gallery and command gallery.&lt;/p&gt;  &lt;h3&gt;Item Gallery vs. Command Gallery&lt;/h3&gt;  &lt;p&gt;In this section we will learn about the differences between an item gallery and a command gallery. There are three differences between the two types of galleries: &lt;/p&gt;  &lt;p&gt;The first difference relates to what the gallery elements are.    &lt;br /&gt;In the item gallery, every element is a &amp;quot;simple&amp;quot; element and is characterized by a text and an image.     &lt;br /&gt;On the other hand, an element in a command gallery is literally a command. This means it has a command ID, which we can handle (as seen in previous posts), and has all the attached resources that a command can have.     &lt;br /&gt;You may think of it as a list of images vs. a list of buttons. &lt;/p&gt;  &lt;p&gt;The second difference is that an item gallery supports the concept of a &amp;quot;selected item&amp;quot;.    &lt;br /&gt;Every element in an item gallery has an index and there is a property on the gallery which we can check for getting the selected item index.     &lt;br /&gt;On the other hand, the commands in the command gallery are not indexed and thus the gallery doesn&amp;#39;t support the concept of a selected item. &lt;/p&gt;  &lt;p&gt;Finally, item galleries support &amp;quot;live preview&amp;quot;. This means you get a notification when the user is hovering over an item (before actual selection); the notification is received via the &lt;b&gt;IUICommandHandler::Execute&lt;/b&gt; method, more on this later. This allows application developers to implement a preview feature where the user can see the result of selecting an item before he actually selects it.     &lt;br /&gt;The Styles control in Microsoft Word 2007 / 2010 is a great example for an item gallery with live preview. Hovering over different styles shows immediately what the effect will be.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_30329BE4.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_21A779F2.png" width="554" height="63" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 2: Styles item gallery in Word 2010&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Command galleries doesn&amp;#39;t support preview. Every element in a command gallery can only be clicked.&lt;/p&gt;  &lt;h3&gt;Gallery Controls&lt;/h3&gt;  &lt;h4&gt;ComboBox&lt;/h4&gt;  &lt;p&gt;A ribbon &lt;b&gt;ComboBox&lt;/b&gt; control is basically the normal ComboBox control that we all know and love, but with the added feature of dividing the items into categories. A category is not an item and cannot be selected from the ComboBox. It is only used to organize the items.     &lt;br /&gt;Categories will be discussed further in this post.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_3ECD21FC.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_27BEA0C0.png" width="113" height="107" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 3: A ComboBox with categories&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;A ribbon &lt;b&gt;ComboBox&lt;/b&gt; is considered a gallery, although it has one limitation that the other gallery types don&amp;#39;t have: It can only be used as an item gallery. This means that the &lt;b&gt;ComboBox&lt;/b&gt; items are always &amp;quot;text / image&amp;quot; items and cannot be, for example, buttons.&lt;/p&gt;  &lt;h5&gt;Defining ComboBox in markup&lt;/h5&gt;  &lt;p&gt;Following is an example of defining a &lt;b&gt;ComboBox&lt;/b&gt; in ribbon markup:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:abfc53be-5096-449f-9190-c081c6ce20ed" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;http://schemas.microsoft.com/windows/2009/Ribbon&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Commands&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;...&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdLayoutGroup&amp;quot;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#ff0000;"&gt; LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Border&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdLayouts&amp;quot;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#ff0000;"&gt; Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;IDR_CMD_LAYOUTS&amp;quot;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#ff0000;"&gt; LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Grid Size&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;...&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Commands&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdTabHome&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;...&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdLayoutGroup&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ComboBox&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdLayouts&amp;quot;&lt;/span&gt;&lt;br /&gt;                                  &lt;span style="color:#ff0000;"&gt; IsEditable&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt;&lt;br /&gt;                                  &lt;span style="color:#ff0000;"&gt; IsAutoCompleteEnabled&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt;&lt;br /&gt;                                  &lt;span style="color:#ff0000;"&gt; ResizeType&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;VerticalResize&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;As you can see, all it takes is a simple &lt;b&gt;ComboBox&lt;/b&gt; markup element, attached to a command. &lt;/p&gt;  &lt;p&gt;The ComboBox XML attributes are as follows: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;CommandName&lt;/b&gt; – The name of the command attached to this ComboBox. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;IsAutoCompleteEnabled&lt;/b&gt; – A flag that indicated whether the ComboBox control should automatically complete the word as you write. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;IsEditable&lt;/b&gt; – A flag that indicates whether to allow free text in the ComboBox. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;ResizeType&lt;/b&gt; – Indicates the allowed type of resizing for the ComboBox. Can be either &lt;b&gt;NoResize&lt;/b&gt; or &lt;b&gt;VerticalResize&lt;/b&gt;. &lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;&lt;/ul&gt;  &lt;h5&gt;Setting ComboBox items&lt;/h5&gt;  &lt;p&gt;As you may recall from previous posts, every command has an implementation of &lt;b&gt;IUICommandHandler&lt;/b&gt; attached to it.     &lt;br /&gt;Setting the &lt;b&gt;ComboBox&lt;/b&gt; items is done by implementing the &lt;b&gt;IUICommandHandler::UpdateProperty&lt;/b&gt; function, specifically, handling the case when the property key is &lt;b&gt;UI_PKEY_ItemsSource&lt;/b&gt;. You can find more information on how to implement &lt;b&gt;IUICommandHandler::UpdateProperty&lt;/b&gt; in &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/13/ribbon-with-c-part-3-using-buttons-with-windows-ribbon-framework.aspx"&gt;part 3&lt;/a&gt; of this series. &lt;/p&gt;  &lt;p&gt;The type of the property &lt;b&gt;ItemsSource&lt;/b&gt; is a collection (&lt;b&gt;IUICollection&lt;/b&gt;) of &lt;b&gt;IUISimplePropertySet&lt;/b&gt;.     &lt;br /&gt;The interface &lt;b&gt;IUICollection&lt;/b&gt; represents a simple collection and has all the common collection functions, such as: &lt;b&gt;Add&lt;/b&gt;, &lt;b&gt;Insert&lt;/b&gt;, &lt;b&gt;RemoveAt&lt;/b&gt;, &lt;b&gt;GetCount&lt;/b&gt;, etc.     &lt;br /&gt;The interface &lt;b&gt;IUISimplePropertySet&lt;/b&gt; represents, as his name suggests, a set of properties. It has only a single function, &lt;b&gt;GetValue&lt;/b&gt;, which should return a property value, given the property identifier.     &lt;br /&gt;Both &lt;b&gt;IUICollection&lt;/b&gt; and &lt;b&gt;IUISimplePropertySet&lt;/b&gt; are defined in the &lt;b&gt;UIRibbon.h&lt;/b&gt;, which comes with the Windows 7 SDK. &lt;/p&gt;  &lt;p&gt;Every element in the &lt;b&gt;ComboBox&lt;/b&gt; or more generally, in an item gallery, has the following properties:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;UI_PKEY_Label – Represents the label of the item. &lt;/li&gt;    &lt;li&gt;UI_PKEY_ItemImage – Represents the item image. &lt;/li&gt;    &lt;li&gt;UI_PKEY_CategoryId – Represents the category id of which this item belongs. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Note that an element in a command gallery has different properties. We will review those properties later in this post.&lt;/p&gt;  &lt;p&gt;Following is an example of how to fill the &lt;b&gt;ItemsSource&lt;/b&gt; property inside the command handler of a &lt;b&gt;ComboBox&lt;/b&gt;. Error handling has been omitted for brevity.&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:29161fe4-d04a-40d2-a4e9-0b986b04871d" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;STDMETHODIMP CLayoutHandler::UpdateProperty(UINT nCmdID,&lt;br /&gt;                                             REFPROPERTYKEY key,&lt;br /&gt;                                             &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPVARIANT* ppropvarCurrentValue,&lt;br /&gt;                                             PROPVARIANT* ppropvarNewValue)&lt;br /&gt; {&lt;br /&gt;     HRESULT hr = S_FALSE;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (key == UI_PKEY_ItemsSource)&lt;br /&gt;     {&lt;br /&gt;         IUICollection* pCollection;&lt;br /&gt;         hr = ppropvarCurrentValue-&amp;gt;punkVal-&amp;gt;QueryInterface( &lt;br /&gt;                                                       IID_PPV_ARGS(&amp;amp;pCollection));&lt;br /&gt;         &lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; labelIds[] = {IDS_LAYOUT_1, IDS_LAYOUT_2, IDS_LAYOUT_3};&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Populate the combobox with the three layout options.&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;for&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; i=0; i&amp;lt;_countof(labelIds); i++)&lt;br /&gt;         {&lt;br /&gt;             &lt;span style="color:#008000;"&gt;// Create a new property set for each item.&lt;/span&gt;&lt;br /&gt;             CPropertySet* pItem;&lt;br /&gt;             hr = CPropertySet::CreateInstance(&amp;amp;pItem);&lt;br /&gt;               &lt;br /&gt;             &lt;span style="color:#008000;"&gt;// Load the label from the resource file.&lt;/span&gt;&lt;br /&gt;             WCHAR wszLabel[MAX_RESOURCE_LENGTH];&lt;br /&gt;             LoadString(GetModuleHandle(NULL), labelIds[i], wszLabel,&lt;br /&gt;                                                              MAX_RESOURCE_LENGTH);&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#008000;"&gt;// Initialize the property set with no image, the label that was just&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#008000;"&gt;// loaded, and no category.&lt;/span&gt;&lt;br /&gt;             pItem-&amp;gt;InitializeItemProperties(&lt;br /&gt;                                       NULL, wszLabel, UI_COLLECTION_INVALIDINDEX);&lt;br /&gt; &lt;br /&gt;             pCollection-&amp;gt;Add(pItem);&lt;br /&gt;         }&lt;br /&gt;         pCollection-&amp;gt;Release();&lt;br /&gt;         hr = S_OK;&lt;br /&gt;     }&lt;br /&gt;     &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; hr;&lt;br /&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;In this example we add three items to the &lt;b&gt;ItemsSource&lt;/b&gt; property of the &lt;b&gt;ComboBox&lt;/b&gt;. This is done by creating an object that implements &lt;b&gt;IUISimplePropertySet&lt;/b&gt;, setting its properties (we set only the label, which is loaded from the resource file), and adding it to the collection. &lt;/p&gt;  &lt;p&gt;The &lt;b&gt;CPropertySet&lt;/b&gt; class is a helper class that implements &lt;b&gt;IUISimplePropertySet&lt;/b&gt; and exposes convenient initialization functions. Its full source is available with the sample application attached to this post. &lt;/p&gt;  &lt;p&gt;The end result for this &lt;b&gt;ComboBox&lt;/b&gt; looks like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_5EB87EF9.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_03699671.png" width="174" height="96" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 4: The ComboBox created by the previous markup and code&lt;/strong&gt;&lt;/p&gt;  &lt;h5&gt;Handling User Selection&lt;/h5&gt;  &lt;p&gt;In this section we will see how to respond to a selection made by the interactive user.    &lt;br /&gt;We will also handle the case where we have an editable ComboBox (&lt;b&gt;IsEditable&lt;/b&gt; = &amp;quot;true&amp;quot;), in which case the user might enter a value which is not part of the ComboBox values. &lt;/p&gt;  &lt;p&gt;Handling the &amp;quot;Selected Change&amp;quot; event is done by implementing &lt;b&gt;IUICommandHandler::Execute&lt;/b&gt;, when the &lt;b&gt;verb&lt;/b&gt; parameter has the value &lt;b&gt;UI_EXECUTIONVERB_EXECUTE&lt;/b&gt; and the &lt;b&gt;key&lt;/b&gt; parameter has the value &lt;b&gt;UI_PKEY_SelectedItem&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;In the following example we see code that handles the user selection. &lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:4d202a23-beed-4eda-b9fb-4a9c55437ff3" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;STDMETHODIMP CBorderSizeHandler::Execute(UINT nCmdID,&lt;br /&gt;                    UI_EXECUTIONVERB verb, &lt;br /&gt;                    &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPERTYKEY* key,&lt;br /&gt;                    &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPVARIANT* ppropvarValue,&lt;br /&gt;                    IUISimplePropertySet* pCommandExecutionProperties)&lt;br /&gt; {&lt;br /&gt;     HRESULT hr = E_FAIL;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (verb == UI_EXECUTIONVERB_EXECUTE)&lt;br /&gt;     {&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (key &amp;amp;&amp;amp; *key == UI_PKEY_SelectedItem)&lt;br /&gt;         {&lt;br /&gt;             ULONG newSize;&lt;br /&gt;             UINT selected = ppropvarValue-&amp;gt;uintVal;&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;switch&lt;/span&gt; (selected)&lt;br /&gt;             {&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; 0:&lt;br /&gt;                 newSize = 1;&lt;br /&gt;                 &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; 1:&lt;br /&gt;                 newSize = 3;&lt;br /&gt;                 &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; 2:&lt;br /&gt;                 newSize = 5;&lt;br /&gt;                 &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt;             &lt;span style="color:#008000;"&gt;// The new selection is a value that the user typed.&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; UI_COLLECTION_INVALIDINDEX: &lt;br /&gt; &lt;br /&gt;                 &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (pCommandExecutionProperties != NULL)&lt;br /&gt;                 {&lt;br /&gt;                     PROPVARIANT var;&lt;br /&gt;                     &lt;span style="color:#008000;"&gt;// The text entered by the user is contained in the property set &lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#008000;"&gt;// with the pkey UI_PKEY_Label.&lt;/span&gt;&lt;br /&gt;                     pCommandExecutionProperties-&amp;gt;GetValue(UI_PKEY_Label, &amp;amp;var); &lt;br /&gt;                     &lt;br /&gt;                     &lt;span style="color:#008000;"&gt;// Convert string to int&lt;/span&gt;&lt;br /&gt;                     BSTR bstr = var.bstrVal;&lt;br /&gt;                     hr = VarUI4FromStr(bstr,GetUserDefaultLCID(),0,&amp;amp;newSize);&lt;br /&gt;                     &lt;br /&gt;                     &lt;span style="color:#008000;"&gt;// Validate new size&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (FAILED(hr) || newSize &amp;lt; 1 || newSize &amp;gt; 15)&lt;br /&gt;                     {&lt;br /&gt;                         &lt;span style="color:#008000;"&gt;// report invalid size&lt;/span&gt;&lt;br /&gt;                         ...&lt;br /&gt;                     }&lt;br /&gt;                     PropVariantClear(&amp;amp;var);&lt;br /&gt;                 }&lt;br /&gt;                 &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt;             }&lt;br /&gt;             &lt;span style="color:#008000;"&gt;// Do something with newSize&lt;/span&gt;&lt;br /&gt;             ...&lt;br /&gt;         }&lt;br /&gt;     }&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; hr;&lt;br /&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;First we check that the correct verb (&lt;b&gt;Execute&lt;/b&gt;) and property key (&lt;b&gt;SelectedItem&lt;/b&gt;) is handled. Then we use &lt;b&gt;ppropvarValue-&amp;gt;uintVal&lt;/b&gt; to extract the &lt;b&gt;index&lt;/b&gt; of the selected item. According to the index we can know what the selected value is. In case the index is &lt;b&gt;UI_COLLECTION_INVALIDINDEX&lt;/b&gt;, which is just a fancy way of saying -1, we can safely assume that the user entered the text manually, in which case we get the label property and parse it.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_0EB2AAAE.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_6633C899.png" width="124" height="97" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 5: An editable ComboBox with custom user text&lt;/strong&gt;&lt;/p&gt;  &lt;h4&gt;DropDownGallery and SplitButtonGallery&lt;/h4&gt;  &lt;p&gt;A &lt;b&gt;DropDownGallery&lt;/b&gt; is just a button that a click on it displays a list of items. The button itself has no action. &lt;/p&gt;  &lt;p&gt;On the other hand, a &lt;b&gt;SplitButtonGallery&lt;/b&gt; has two buttons, one that is used as a default action and another one that opens a list of items. &lt;/p&gt;  &lt;p&gt;This difference between these two galleries is similar to the difference between the &lt;b&gt;SplitButton&lt;/b&gt; control and &lt;b&gt;DropDownButton&lt;/b&gt; control, seen on &lt;u&gt;part 3&lt;/u&gt; (Add link to post 3) of this post series. &lt;/p&gt;  &lt;p&gt;In the following image, on the right, you can see a &lt;b&gt;SplitButtonGallery&lt;/b&gt; which is composed of a split button, on the top part (the image) there is a button and on the lower part (the &amp;quot;Style&amp;quot; text) there is an arrow that opens the list of items.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_76CBC387.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_67D46EA0.png" width="308" height="210" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 6: On the left: a DropDownGallery with categories, On the right: a SplitButtonGallery&lt;/strong&gt;&lt;/p&gt;  &lt;h5&gt;Defining SplitButtonGallery in markup&lt;/h5&gt;  &lt;p&gt;In the following markup code we see how to define a &lt;b&gt;SplitButtonGallery&lt;/b&gt;. The code should be placed in the ribbon markup &amp;quot;views&amp;quot; section.&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:53346a8e-c58a-4630-ac6a-d327bd72219e" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButtonGallery&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdBorderStyles&amp;quot;&lt;/span&gt;&lt;br /&gt;                    &lt;span style="color:#ff0000;"&gt; Type&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Items&amp;quot;&lt;/span&gt;&lt;br /&gt;                    &lt;span style="color:#ff0000;"&gt; TextPosition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Hide&amp;quot;&lt;/span&gt;&lt;br /&gt;                    &lt;span style="color:#ff0000;"&gt; HasLargeItems&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButtonGallery.MenuLayout&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;VerticalMenuLayout&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButtonGallery.MenuLayout&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButtonGallery&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The &lt;b&gt;SplitButtonGallery&lt;/b&gt; XML attributes are as follows: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;CommandName&lt;/b&gt; – The name of the command attached to this SplitButtonGallery. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Type&lt;/b&gt; – The type of the gallery. It can be either &lt;b&gt;Items&lt;/b&gt; or &lt;b&gt;Commands&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;TextPosition&lt;/b&gt; – The position where to show the attached text. This can be one the following values: &lt;b&gt;Top&lt;/b&gt;, &lt;b&gt;Left&lt;/b&gt;, &lt;b&gt;Right&lt;/b&gt;, &lt;b&gt;Bottom&lt;/b&gt;, &lt;b&gt;Overlap&lt;/b&gt; and &lt;b&gt;Hide&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;HasLargeItems&lt;/b&gt; – Indicates whether the large or small image resource of the Command is displayed. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The &lt;b&gt;MenuLayout&lt;/b&gt; attribute defines how the list of elements will present itself.     &lt;br /&gt;&lt;b&gt;VerticalMenuLayout&lt;/b&gt; is used to show a vertical layout.     &lt;br /&gt;Another option is &lt;b&gt;FlowMenuLayout&lt;/b&gt;, which we will review on the next code example. &lt;/p&gt;  &lt;h5&gt;Setting SplitButtonGallery items with images&lt;/h5&gt;  &lt;p&gt;Since in this example the &lt;b&gt;SplitButtonGallery&lt;/b&gt; is used as an item gallery, adding items is done similarly to how it was done in the previous &lt;b&gt;ComboBox&lt;/b&gt; sample. However, we will also see how we can provide image resources to the items. As always, error handling has been omitted.&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:870e614d-0bac-4fb6-9fce-3bbd3c082218" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;STDMETHODIMP CBorderStyleHandler::UpdateProperty(UINT nCmdID,&lt;br /&gt;                                             REFPROPERTYKEY key,&lt;br /&gt;                                             &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPVARIANT* ppropvarCurrentValue,&lt;br /&gt;                                             PROPVARIANT* ppropvarNewValue)&lt;br /&gt; {&lt;br /&gt;     HRESULT hr = S_FALSE;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (key == UI_PKEY_ItemsSource)&lt;br /&gt;     {&lt;br /&gt;         IUICollection* pCollection;&lt;br /&gt;         hr = ppropvarCurrentValue-&amp;gt;punkVal-&amp;gt;QueryInterface(&lt;br /&gt;                                                           IID_PPV_ARGS(&amp;amp;pCollection));&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; imageIds[] = {IDB_NONE, IDB_SOLID, IDB_DASH};&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; labelIds[] = {IDS_BORDER_NONE, IDS_BORDER_SOLID, IDS_BORDER_DASH};&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Populate the dropdown with the three border styles.&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;for&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; i=0; i&amp;lt;_countof(labelIds); i++)&lt;br /&gt;         {&lt;br /&gt;             &lt;span style="color:#008000;"&gt;// Create a new property set for each item.&lt;/span&gt;&lt;br /&gt;             CPropertySet* pItem;&lt;br /&gt;             hr = CPropertySet::CreateInstance(&amp;amp;pItem);&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#008000;"&gt;// Create an IUIImage from a resource id.&lt;/span&gt;&lt;br /&gt;             IUIImage* pImg;&lt;br /&gt;             CreateUIImageFromBitmapResource(MAKEINTRESOURCE(imageIds[i]), &amp;amp;pImg);&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#008000;"&gt;// Load the label from the resource file.&lt;/span&gt;&lt;br /&gt;             WCHAR wszLabel[MAX_RESOURCE_LENGTH];&lt;br /&gt;             LoadString(GetModuleHandle(NULL), labelIds[i], wszLabel,&lt;br /&gt;                                                                  MAX_RESOURCE_LENGTH);&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#008000;"&gt;// Initialize the property set with the image and label that were just&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#008000;"&gt;// loaded and no category.&lt;/span&gt;&lt;br /&gt;             pItem-&amp;gt;InitializeItemProperties(pImg, wszLabel,&lt;br /&gt;                                                           UI_COLLECTION_INVALIDINDEX);&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#008000;"&gt;// Add the newly-created property set to the collection &lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#008000;"&gt;// supplied by the framework.&lt;/span&gt;&lt;br /&gt;             pCollection-&amp;gt;Add(pItem);&lt;br /&gt; &lt;br /&gt;             pItem-&amp;gt;Release();&lt;br /&gt;             pImg-&amp;gt;Release();&lt;br /&gt;         }&lt;br /&gt;         pCollection-&amp;gt;Release();&lt;br /&gt;         hr = S_OK;&lt;br /&gt;     }&lt;br /&gt;     &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; hr;&lt;br /&gt; }&lt;br /&gt; &lt;span style="color:#008000;"&gt;// Factory method to create IUIImages from resource identifiers.&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; CBorderStyleHandler::CreateUIImageFromBitmapResource(LPCTSTR pszResource, &lt;br /&gt;                                                              IUIImage **ppimg)&lt;br /&gt; {&lt;br /&gt;     IUIImageFromBitmap* m_pifbFactory;&lt;br /&gt;     &lt;br /&gt;     CoCreateInstance(CLSID_UIRibbonImageFromBitmapFactory, &lt;br /&gt;                      NULL, CLSCTX_ALL, IID_PPV_ARGS(&amp;amp;m_pifbFactory));&lt;br /&gt;     &lt;br /&gt;     &lt;span style="color:#008000;"&gt;// Load the bitmap from the resource file.&lt;/span&gt;&lt;br /&gt;     HBITMAP hbm = (HBITMAP) LoadImage(GetModuleHandle(NULL), pszResource,&lt;br /&gt;                                       IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);&lt;br /&gt;     &lt;br /&gt;     &lt;span style="color:#008000;"&gt;// Use the factory implemented by the framework to produce an IUIImage.&lt;/span&gt;&lt;br /&gt;     m_pifbFactory-&amp;gt;CreateImage(hbm, UI_OWNERSHIP_TRANSFER, ppimg);&lt;br /&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The important thing to note is the helper function &lt;b&gt;CreateUIImageFromBitmapResource. &lt;/b&gt;This function loads a bitmap resource and converts it to an instance of &lt;b&gt;IUIImage&lt;/b&gt;, which is the ribbon wrapper for a bitmap. The conversion is done using a COM object provided by the Windows Ribbon Framework, named &lt;b&gt;UIRibbonImageFromBitmapFactory&lt;/b&gt;. This object implements the interface &lt;b&gt;IUIImageFromBitmap&lt;/b&gt; which has only one function, &lt;b&gt;CreateImage&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;The &lt;b&gt;CreateImage&lt;/b&gt; function takes an &lt;b&gt;HBITMAP&lt;/b&gt; handle as its first parameter and returns a pointer to &lt;b&gt;IUIImage&lt;/b&gt;. The second parameter controls the ownership of the created image, and take the value &lt;b&gt;UI_OWNERSHIP_TRANSFER&lt;/b&gt; in case you want to transfer the responsibility of releasing the handle to the ribbon framework, or &lt;b&gt;UI_OWNERSHIP_COPY &lt;/b&gt;in case you plan to reuse the same &lt;b&gt;HBITMAP&lt;/b&gt; from other places in your application, and so need to release it only when you are done. &lt;/p&gt;  &lt;h5&gt;Defining DropDownGallery in markup&lt;/h5&gt;  &lt;p&gt;In the following markup code we see how to define a &lt;b&gt;DropDownGallery&lt;/b&gt;. The code should be placed in the ribbon markup &amp;quot;views&amp;quot; section.&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7f04b5b2-dbf9-4128-9d53-1ef24c68b6c3" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DropDownGallery&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdSizeAndColor&amp;quot;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#ff0000;"&gt; TextPosition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Hide&amp;quot;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#ff0000;"&gt; Type&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Commands&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DropDownGallery.MenuLayout&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;FlowMenuLayout&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Rows&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;2&amp;quot;&lt;/span&gt;&lt;br /&gt;                        &lt;span style="color:#ff0000;"&gt; Columns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;3&amp;quot;&lt;/span&gt;&lt;br /&gt;                        &lt;span style="color:#ff0000;"&gt; Gripper&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;None&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DropDownGallery.MenuLayout&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DropDownGallery&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Note that this time we used &amp;quot;&lt;b&gt;Commands&lt;/b&gt;&amp;quot; as the type of the gallery. This means that this particular instance of &lt;b&gt;DropDownGallery&lt;/b&gt; will be used as a command gallery.     &lt;br /&gt;Most of the &lt;b&gt;DropDownGallery&lt;/b&gt; XML attributes are similar to the attributes of &lt;b&gt;SplitButtonGallery&lt;/b&gt;, so I&amp;#39;ll only explain the &lt;b&gt;FlowMenuLayout&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;The &lt;b&gt;FlowMenuLayout&lt;/b&gt; XML element is used to define a rich layout for the gallery items. We use the &lt;b&gt;Rows&lt;/b&gt; and &lt;b&gt;Columns&lt;/b&gt; attributes to control the number of rows and columns in the gallery rectangle. On figure 6, the left control is the result of this definition. Note that the categories seen in the image will be defined later in the code. &lt;/p&gt;  &lt;p&gt;Before we continue, I owe you from a previous section the available properties for an element in a command gallery.    &lt;br /&gt;Every element in a command gallery has the following properties: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;UI_PKEY_CommandId – Represents the command id of the element. &lt;/li&gt;    &lt;li&gt;&lt;a name="OLE_LINK1"&gt;UI_PKEY_CommandType &lt;/a&gt;– Represents the type the command. &lt;/li&gt;    &lt;li&gt;UI_PKEY_CategoryId – Represents the category id of which this item belongs. &lt;/li&gt; &lt;/ul&gt;  &lt;h5&gt;Setting DropDownGallery commands items with categories&lt;/h5&gt;  &lt;p&gt;In the following code we see how to fill the previously defined &lt;b&gt;DropDownGallery&lt;/b&gt;. This time we fill it with commands elements. In addition we will divide the commands into two categories.&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:51a9e9c8-ecb5-4f7a-8306-eb5cab6e5a29" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;STDMETHODIMP CSizeAndColorHandler::UpdateProperty(UINT nCmdID,&lt;br /&gt;                               REFPROPERTYKEY key,&lt;br /&gt;                               &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPVARIANT* ppropvarCurrentValue,&lt;br /&gt;                               PROPVARIANT* ppropvarNewValue)&lt;br /&gt; {&lt;br /&gt;     HRESULT hr = E_FAIL;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (key == UI_PKEY_Categories)&lt;br /&gt;     {&lt;br /&gt;         IUICollection* pCollection;&lt;br /&gt;         hr = ppropvarCurrentValue-&amp;gt;punkVal-&amp;gt;QueryInterface(&lt;br /&gt;                                                           IID_PPV_ARGS(&amp;amp;pCollection));&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Create a property set for the Size category.&lt;/span&gt;&lt;br /&gt;         CPropertySet *pSize;&lt;br /&gt;         hr = CPropertySet::CreateInstance(&amp;amp;pSize);&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Load the label for the Size category from the resource file.&lt;/span&gt;&lt;br /&gt;         WCHAR wszSizeLabel[MAX_RESOURCE_LENGTH];&lt;br /&gt;         LoadString(GetModuleHandle(NULL), IDS_SIZE_CATEGORY, &lt;br /&gt;                                                    wszSizeLabel, MAX_RESOURCE_LENGTH);&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Initialize the property set with the label that was just loaded and &lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#008000;"&gt;// a category id of 0.&lt;/span&gt;&lt;br /&gt;         pSize-&amp;gt;InitializeCategoryProperties(wszSizeLabel, 0);&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Add the newly-created property set to the collection supplied &lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#008000;"&gt;// by the framework.&lt;/span&gt;&lt;br /&gt;         pCollection-&amp;gt;Add(pSize);&lt;br /&gt; &lt;br /&gt;         pSize-&amp;gt;Release();&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Create a property set for the Color category.&lt;/span&gt;&lt;br /&gt;         CPropertySet *pColor;&lt;br /&gt;         hr = CPropertySet::CreateInstance(&amp;amp;pColor);&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Load the label for the Color category from the resource file.&lt;/span&gt;&lt;br /&gt;         WCHAR wszColorLabel[MAX_RESOURCE_LENGTH];&lt;br /&gt;         LoadString(GetModuleHandle(NULL), IDS_COLOR_CATEGORY, &lt;br /&gt;                                                   wszColorLabel, MAX_RESOURCE_LENGTH);&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Initialize the property set with the label that was just loaded and &lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#008000;"&gt;// a category id of 1.&lt;/span&gt;&lt;br /&gt;         pColor-&amp;gt;InitializeCategoryProperties(wszColorLabel, 1);&lt;br /&gt;         &lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Add the newly-created property set to the collection supplied &lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#008000;"&gt;// by the framework.&lt;/span&gt;&lt;br /&gt;         pCollection-&amp;gt;Add(pColor);&lt;br /&gt; &lt;br /&gt;         pColor-&amp;gt;Release();&lt;br /&gt;         pCollection-&amp;gt;Release();&lt;br /&gt; &lt;br /&gt;         hr = S_OK;&lt;br /&gt;     }&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;else&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (key == UI_PKEY_ItemsSource)&lt;br /&gt;     {&lt;br /&gt;         IUICollection* pCollection;&lt;br /&gt;         hr = ppropvarCurrentValue-&amp;gt;punkVal-&amp;gt;QueryInterface(&lt;br /&gt;                                                           IID_PPV_ARGS(&amp;amp;pCollection));&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; commandIds[] = {IDR_CMD_SMALL, IDR_CMD_MEDIUM, IDR_CMD_LARGE, &lt;br /&gt;                             IDR_CMD_RED, IDR_CMD_GREEN, IDR_CMD_BLUE};&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; categoryIds[] = {0, 0, 0, 1, 1, 1};&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Populate the gallery with the three size and three colors in &lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#008000;"&gt;// two separate categories.&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;for&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; i=0; i&amp;lt;_countof(commandIds); i++)&lt;br /&gt;         {&lt;br /&gt;             &lt;span style="color:#008000;"&gt;// Create a new property set for each item.&lt;/span&gt;&lt;br /&gt;             CPropertySet* pCommand;&lt;br /&gt;             hr = CPropertySet::CreateInstance(&amp;amp;pCommand);&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#008000;"&gt;// Initialize the property set with the appropriate command id and &lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#008000;"&gt;// category id and type Boolean (which makes these appear as &lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#008000;"&gt;// ToggleButtons).&lt;/span&gt;&lt;br /&gt;             pCommand-&amp;gt;InitializeCommandProperties(categoryIds[i], commandIds[i],&lt;br /&gt;                                                               UI_COMMANDTYPE_BOOLEAN);&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#008000;"&gt;// Add the newly-created property set to the collection supplied &lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#008000;"&gt;// by the framework.&lt;/span&gt;&lt;br /&gt;             pCollection-&amp;gt;Add(pCommand);&lt;br /&gt; &lt;br /&gt;             pCommand-&amp;gt;Release();&lt;br /&gt;         }&lt;br /&gt;         pCollection-&amp;gt;Release();&lt;br /&gt;         hr = S_OK;&lt;br /&gt;     }&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; hr;&lt;br /&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;In this code we first define &lt;b&gt;Categories&lt;/b&gt; property, which contains the list of available categories (in our case, just two items), and then the &lt;b&gt;ItemsSource&lt;/b&gt; property. &lt;/p&gt;  &lt;p&gt;The items elements are now commands which have a command id and command type. In our case we used &lt;b&gt;UI_COMMANDTYPE_BOOLEAN&lt;/b&gt; which makes the commands appear as &lt;b&gt;ToggleButton&lt;/b&gt; controls. Note that we didn&amp;#39;t define any image resource for the elements. The image comes from the previously define command resources. &lt;/p&gt;  &lt;p&gt;Also, check the implementation of the gallery&amp;#39;s &lt;b&gt;Execute&lt;/b&gt; function:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:815bce7f-6aea-4485-8a49-fd1bff381569" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;STDMETHODIMP CSizeAndColorHandler::Execute(UINT nCmdID,&lt;br /&gt;                    UI_EXECUTIONVERB verb, &lt;br /&gt;                    &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPERTYKEY* key,&lt;br /&gt;                    &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPVARIANT* ppropvarValue,&lt;br /&gt;                    IUISimplePropertySet* pCommandExecutionProperties)&lt;br /&gt; {&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; E_FAIL;&lt;br /&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The implementation is rather empty since the handling of the commands is done by the command handler attached to the elements command id. The gallery&amp;#39;s &lt;b&gt;Execute&lt;/b&gt; function is never actually called. &lt;/p&gt;  &lt;h4&gt;InRibbonGallery&lt;/h4&gt;  &lt;p&gt;An &lt;b&gt;InRibbonGallery&lt;/b&gt; is a gallery in which the items are displayed inside the ribbon. Other than its visual representation, it&amp;#39;s functionally equivalent to the &lt;b&gt;DropDownGallery&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_10AF5DDD.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_2002BFEC.png" width="319" height="71" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 7: An example of InRibbonGallery control&lt;/strong&gt;&lt;/p&gt;  &lt;h5&gt;Defining InRibbonGallery in markup&lt;/h5&gt;  &lt;p&gt;In &lt;a name="OLE_LINK4"&gt;&lt;/a&gt;&lt;a name="OLE_LINK3"&gt;the following &lt;/a&gt;markup code we see how to define an &lt;b&gt;InRibbonGallery&lt;/b&gt;. As always, view related code should be placed in the ribbon markup &amp;quot;views&amp;quot; section.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d8668c37-6e10-44a4-87ec-b09c97604568" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;InRibbonGallery&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdShapes&amp;quot;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#ff0000;"&gt; Type&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Items&amp;quot;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#ff0000;"&gt; TextPosition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Bottom&amp;quot;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#ff0000;"&gt; MaxColumns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;3&amp;quot;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#ff0000;"&gt; MaxRows&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;1&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;All of these XML attributes are already known or self-explanatory.&lt;/p&gt;  &lt;h5&gt;Handling live preview in an item gallery&lt;/h5&gt;  &lt;p&gt;One of the benefits of an item gallery is its support for the live preview feature, i.e. it allows the user to see the result of a selection before just by hovering over an item. If the user doesn&amp;#39;t select an item and move the mouse cursor away, the selection effect is removed. &lt;/p&gt;  &lt;p&gt;In the following code we see how to implement &lt;b&gt;IUICommandHandler::Execute&lt;/b&gt; in order to handle the live preview feature:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:918210b7-4eda-46a2-b038-88dc7288d806" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;STDMETHODIMP CShapeHandler::Execute(UINT nCmdID,&lt;br /&gt;                    UI_EXECUTIONVERB verb, &lt;br /&gt;                    &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPERTYKEY* key,&lt;br /&gt;                    &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPVARIANT* ppropvarValue,&lt;br /&gt;                    IUISimplePropertySet* pCommandExecutionProperties)&lt;br /&gt; {&lt;br /&gt;     HRESULT hr = E_FAIL;&lt;br /&gt; &lt;br /&gt;     UINT selected;&lt;br /&gt;     hr = UIPropertyToUInt32(*key, *ppropvarValue, &amp;amp;selected);&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;switch&lt;/span&gt; (verb)&lt;br /&gt;     {&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; UI_EXECUTIONVERB_PREVIEW:&lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Show a preview of a new shape.    &lt;/span&gt;&lt;br /&gt;         ShowItem(selected);&lt;br /&gt;         hr = S_OK;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; UI_EXECUTIONVERB_CANCELPREVIEW:&lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Show the shape that was selected before the preview - &lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#008000;"&gt;// ppropvarValue contains the previous selected item.&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#008000;"&gt;// Note that the developer did not have to store the value from before &lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#008000;"&gt;// preview was called.&lt;/span&gt;&lt;br /&gt;         ShowItem(selected);&lt;br /&gt;         hr = S_OK;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; UI_EXECUTIONVERB_EXECUTE:&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; ( key &amp;amp;&amp;amp; *key == UI_PKEY_SelectedItem)&lt;br /&gt;         {      &lt;br /&gt;             &lt;span style="color:#008000;"&gt;// Update the renderer with the newly-selected shape.&lt;/span&gt;&lt;br /&gt;             ShowItem(selected);&lt;br /&gt;             hr = S_OK;&lt;br /&gt;         }&lt;br /&gt;     }&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; hr;&lt;br /&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;We handle three different verbs: &lt;b&gt;Preview&lt;/b&gt;, &lt;b&gt;CancelPreview&lt;/b&gt; and &lt;b&gt;Execute&lt;/b&gt;.     &lt;br /&gt;The &lt;b&gt;Preview&lt;/b&gt; verb is passed when the user hovers over an item, in which case we also get the hovered item index. The &lt;b&gt;CancelPreview&lt;/b&gt; verb is passed when a user moves the mouse cursor away from the item gallery. Note that in the &lt;b&gt;CancelPreview&lt;/b&gt; case we get the previously selected item so the developer doesn&amp;#39;t need to save the previous item.     &lt;br /&gt;The last case is when the passed verb is &lt;b&gt;Execute&lt;/b&gt;, which means the user has selected an item. &lt;/p&gt;  &lt;p&gt;The &lt;b&gt;ShowItem&lt;/b&gt; function is in charge of doing the selection effect, for example, drawing a new shape according to the selected one. &lt;/p&gt;  &lt;h3&gt;Summary&lt;/h3&gt;  &lt;p&gt;The sample application attached to this post is the taken from the &lt;strong&gt;Windows 7 SDK &lt;/strong&gt;&amp;quot;Gallery&amp;quot; ribbon sample. You can find it either &lt;a href="http://blogs.microsoft.co.il/blogs/arik/RibbonPost5Demo.zip"&gt;here&lt;/a&gt; or in your local folder     &lt;br /&gt;&amp;quot;&lt;strong&gt;\Program Files\Microsoft SDKs\Windows\v7.0\Samples\winui\WindowsRibbon\Gallery\&lt;/strong&gt;&amp;quot;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_763F44F8.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_18D35DA7.png" width="553" height="169" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 8: Sample application for this post&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In this post we have learned how to use the ribbon gallery controls. We learned about the difference between an item gallery and a command gallery. We saw the different gallery controls: &lt;b&gt;ComboBox, SplitButtonGallery, DropDownGallery&lt;/b&gt; and &lt;b&gt;InRibbonGallery&lt;/b&gt;. And we saw how to add items, categories and images, and how to provide support for live preview. &lt;/p&gt;  &lt;p&gt;That&amp;#39;s it for now,    &lt;br /&gt;Arik Poznanski.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/16/ribbon-with-c-part-5-using-galleries-with-windows-ribbon-framework.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/16/ribbon-with-c-part-5-using-galleries-with-windows-ribbon-framework.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/16/ribbon-with-c-part-5-using-galleries-with-windows-ribbon-framework.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/16/ribbon-with-c-part-5-using-galleries-with-windows-ribbon-framework.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=172641" rel="tag" style="display:none;"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=843425" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/COM/default.aspx">COM</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2B002B00_/default.aspx">C++</category></item><item><title>Ribbon with C++, Part 4: Layout Controls in Windows Ribbon Framework</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/15/ribbon-with-c-part-4-layout-controls-in-windows-ribbon-framework.aspx</link><pubDate>Wed, 15 Jun 2011 05:16:50 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:842946</guid><dc:creator>arik</dc:creator><slash:comments>8</slash:comments><description>&lt;p&gt;This is the 4&lt;sup&gt;th&lt;/sup&gt; post about &lt;strong&gt;Windows Ribbon Framework&lt;/strong&gt; features.     &lt;br /&gt;On previous posts we have &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/03/ribbon-with-c-part-1-introduction-to-the-windows-ribbon-framework.aspx"&gt;introduced&lt;/a&gt; the Windows Ribbon Framework, shown a &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/06/ribbon-with-c-part-2-first-ribbon-enabled-application.aspx"&gt;complete&lt;/a&gt; example of how to develop a ribbon enabled application and reviewed the different &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/13/ribbon-with-c-part-3-using-buttons-with-windows-ribbon-framework.aspx"&gt;buttons&lt;/a&gt;-based UI controls that the ribbon framework provides. &lt;/p&gt;  &lt;p&gt;In this post we continue our review of the various features in the Windows Ribbon Framework. This time we will focus on a task that every ribbon application developer should address: How to layout UI controls on the ribbon. &lt;/p&gt;  &lt;p&gt;We will see how to define tabs and groups, what the tab scaling policy is, and how to control it. After that we will see how to layout controls in groups using predefined layouts and how to define new custom layouts. &lt;/p&gt;  &lt;p&gt;On the second half of this post we will see what the ribbon application menu is, and how to add ribbon controls to it. &lt;/p&gt;  &lt;h3&gt;&lt;a name="OLE_LINK1"&gt;Arranging Controls in Tabs and Groups&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;The ribbon is divided into tabs. A &lt;b&gt;Tab&lt;/b&gt; encapsulates commands which belong to the same logical category. For example, the &amp;quot;Insert&amp;quot; tab in Microsoft Word contains all the different objects one might insert into a word document, such as picture, shape, table, etc. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image002_39FF1941.jpg"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image002" alt="clip_image002" src="http://blogs.microsoft.co.il/blogs/arik/clip_image002_thumb_5E144E03.jpg" width="692" height="173" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 1: Tabs and groups in Microsoft Word 2010&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;A &lt;b&gt;Group&lt;/b&gt;, also called &lt;b&gt;Chunk&lt;/b&gt; in some Ribbon APIs, is like a sub category inside a tab. &lt;/p&gt;  &lt;h4&gt;Defining Tabs and Groups in Ribbon Markup&lt;/h4&gt;  &lt;p&gt;Defining tabs and groups is done using the Tab and Group XML elements.    &lt;br /&gt;In the following code snippet we define a ribbon with two tabs, and three groups:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7ba6cedc-b6d3-43a0-b7d1-dc0b0fc7ef95" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdTabMain&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupFileActions&amp;quot;&lt;/span&gt;&lt;br /&gt;                       &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;ThreeButtons&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonNew&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonOpen&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonSave&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupExit&amp;quot;&lt;/span&gt;&lt;br /&gt;                       &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;OneButton&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonExit&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdTabMore&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupMore&amp;quot;&lt;/span&gt;&lt;br /&gt;                       &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;ThreeButtons&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonMoreA&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonMoreB&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonMoreC&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The &lt;b&gt;SizeDefinition&lt;/b&gt; attribute of the &lt;b&gt;Group&lt;/b&gt; XML element defines what will be the actual layout of the controls inside the group. We will learn more on this attribute later in this post.&lt;/p&gt;  &lt;h4&gt;Tab Scaling Policy&lt;/h4&gt;  &lt;p&gt;In order to understand this part you should know that one of the features of the Windows Ribbon Framework is the ability to re-layout your ribbon controls according to the amount of screen space the ribbon has. It pretty much handles this automatically but it does require you to define hints on how you want your layout to scale when the application form gets smaller and smaller. &lt;/p&gt;  &lt;p&gt;To better understand the meaning of scaling policy, let&amp;#39;s consider the &amp;quot;View&amp;quot; tab in Microsoft Paint when the window is resized. &lt;/p&gt;  &lt;p&gt;Following is an image of Microsoft Paint, where the &amp;quot;View&amp;quot; tab is in its fullest form:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image001_2AC7EECD.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image001" alt="clip_image001" src="http://blogs.microsoft.co.il/blogs/arik/clip_image001_thumb_678C4AD2.png" width="594" height="193" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 2: View tab in full form&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;On the next image, the window size has been reduced, which caused the &amp;quot;Zoom&amp;quot; group to scale to a smaller layout:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image0015_147187E1.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image001[5]" alt="clip_image001[5]" src="http://blogs.microsoft.co.il/blogs/arik/clip_image0015_thumb_3771D384.png" width="421" height="190" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 3: Zoom group scaled to a smaller layout&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;On the next image, the window size has been reduced again, resulting in a scale down of the &amp;quot;Display&amp;quot; group:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image002_39DAB9A8.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image002" alt="clip_image002" src="http://blogs.microsoft.co.il/blogs/arik/clip_image002_thumb_36792200.png" width="359" height="192" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 4: Display group scaled to a smaller layout&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;On the next image, the window size has been reduced yet again, resulting in another scale down of the &amp;quot;Zoom&amp;quot; group, this time into a pop-up layout:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image003_3498A66C.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image003" alt="clip_image003" src="http://blogs.microsoft.co.il/blogs/arik/clip_image003_thumb_3E30EED5.png" width="322" height="193" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 5: Zoom group scaled to popup layout&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;On the next image, we see what happens when the window size gets too small. The ribbon will disappear completely:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image004_5FECA199.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image004" alt="clip_image004" src="http://blogs.microsoft.co.il/blogs/arik/clip_image004_thumb_1D998956.png" width="231" height="195" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 6: Ribbon disappear when the window size is too small&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;So, to summarize the example: each group has a starting size, which from now on will be called &amp;quot;ideal size&amp;quot;. As the window size gets smaller the groups start to scale down to smaller sizes, but not necessarily in the &amp;quot;normal&amp;quot; order of the groups. &lt;/p&gt;  &lt;p&gt;First, the Zoom group scaled to &lt;b&gt;Small&lt;/b&gt; size.     &lt;br /&gt;Then, the Display group scaled to &lt;b&gt;Small&lt;/b&gt; size.     &lt;br /&gt;Finally, the Zoom group scaled to &lt;b&gt;Popup&lt;/b&gt; size. &lt;/p&gt;  &lt;p&gt;In general, one can define for each group in the ribbon the ideal size for it, which is the default size if the group has an infinite amount of space. The size can be one of four values: &lt;b&gt;Large&lt;/b&gt;, &lt;b&gt;Medium&lt;/b&gt;, &lt;b&gt;Small&lt;/b&gt; and &lt;b&gt;Popup&lt;/b&gt;.     &lt;br /&gt;The actual layout of the controls in the group with different value sizes is dependent on the layout template, which we shall review later on.     &lt;br /&gt;The&lt;b&gt; Popup&lt;/b&gt; value means that the group has shrunk to a single icon that popups the original group (in ideal size) upon clicking. &lt;/p&gt;  &lt;p&gt;After defining the ideal size for the group we can define the order of scaling down, meaning which group should scale down first and to what size. In this way you can have your most important controls in your application visible longer that the less important ones. &lt;/p&gt;  &lt;p&gt;Following is an example of how to define the tab scaling policy for a specific tab:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f8918b0b-c41c-4372-a997-2b5b66cdeed0" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdTabMain&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab.ScalingPolicy&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ScalingPolicy&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ScalingPolicy.IdealSizes&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Scale&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupFileActions&amp;quot;&lt;/span&gt;&lt;br /&gt;                                   &lt;span style="color:#ff0000;"&gt; Size&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Large&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Scale&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupExit&amp;quot;&lt;/span&gt;&lt;br /&gt;                                   &lt;span style="color:#ff0000;"&gt; Size&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Large&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ScalingPolicy.IdealSizes&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Scale&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupFileActions&amp;quot;&lt;/span&gt;&lt;br /&gt;                               &lt;span style="color:#ff0000;"&gt; Size&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Medium&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ScalingPolicy&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab.ScalingPolicy&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupFileActions&amp;quot;&lt;/span&gt;&lt;br /&gt;                       &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;ThreeButtons&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonNew&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonOpen&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonSave&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupExit&amp;quot;&lt;/span&gt;&lt;br /&gt;                       &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;OneButton&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonExit&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdTabMore&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupMore&amp;quot;&lt;/span&gt;&lt;br /&gt;                       &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;ThreeButtons&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonMoreA&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonMoreB&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonMoreC&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;In this example we define that the ideal size for both the &amp;quot;File Actions&amp;quot; group and &amp;quot;Exit&amp;quot; group is &lt;b&gt;Large&lt;/b&gt;. This is done using the &lt;b&gt;ScalingPolicy.IdealSizes&lt;/b&gt; XML element.     &lt;br /&gt;Then we define the order of scaling when the window size gets smaller. In our example we only define that the next scaling operation should scale the &amp;quot;File Actions&amp;quot; group down to &lt;b&gt;Medium&lt;/b&gt; size.&lt;/p&gt;  &lt;h4&gt;Setting Group Layout&lt;/h4&gt;  &lt;p&gt;Now we will see how to actually define the layout of the controls inside a ribbon group. &lt;/p&gt;  &lt;p&gt;If you remember from the previous examples, we often set a &lt;b&gt;SizeDefinition&lt;/b&gt; attribute on the group element. The &lt;b&gt;SizeDefinition&lt;/b&gt; is the ribbon markup attribute which allows us, developers, to control the layout of controls in a group. &lt;/p&gt;  &lt;p&gt;The value of the &lt;strong&gt;SizeDefinition&lt;/strong&gt; attribute is a name of a layout template.     &lt;br /&gt;Every layout template defines: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A list of controls participating in the layout template. &lt;/li&gt;    &lt;li&gt;A definition of how to arrange these controls for a given group size.      &lt;br /&gt;Remember that every group can scale to the following sizes: Large, Medium, Small and Popup. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;There are two types of layout templates: Predefined layout templates and Custom layout templates. &lt;/p&gt;  &lt;h5&gt;Predefined Layout Templates &lt;/h5&gt;  &lt;p&gt;Microsoft has provided with the Windows Ribbon Framework a list of predefined common layout template so we can use them in our groups without having to specify the exact layout. Up until now, ALL the previous examples used them. &lt;/p&gt;  &lt;p&gt;Reminder:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:4d789ea5-3065-4e9f-abc8-ca6fc8846cce" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupFileActions&amp;quot;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;ThreeButtons&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonNew&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonOpen&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonSave&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The “&lt;b&gt;ThreeButtons&lt;/b&gt;” is a name of a predefined layout template that handles the layout for three buttons. This layout template defines two possible sizes: &lt;b&gt;Large&lt;/b&gt; and &lt;b&gt;Medium&lt;/b&gt;.     &lt;br /&gt;Note that Popup is always available since it doesn&amp;#39;t have a special layout definition (It&amp;#39;s always a single icon).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image0017_7421F5BD.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image001[7]" alt="clip_image001[7]" src="http://blogs.microsoft.co.il/blogs/arik/clip_image0017_thumb_2F45ABBC.png" width="317" height="120" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 7: Medium size and Large size defined in ThreeButtons predefined layout template&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Following is the list of all available predefined layout templates: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;OneButton &lt;/li&gt;    &lt;li&gt;TwoButtons &lt;/li&gt;    &lt;li&gt;ThreeButtons &lt;/li&gt;    &lt;li&gt;ThreeButtons-OneBigAndTwoSmall &lt;/li&gt;    &lt;li&gt;ThreeButtonsAndOneCheckBox &lt;/li&gt;    &lt;li&gt;FourButtons &lt;/li&gt;    &lt;li&gt;FiveButtons &lt;/li&gt;    &lt;li&gt;FiveOrSixButtons &lt;/li&gt;    &lt;li&gt;SixButtons &lt;/li&gt;    &lt;li&gt;SixButtons-TwoColumns &lt;/li&gt;    &lt;li&gt;SevenButtons &lt;/li&gt;    &lt;li&gt;EightButtons &lt;/li&gt;    &lt;li&gt;EightButtons-LastThreeSmall &lt;/li&gt;    &lt;li&gt;NineButtons &lt;/li&gt;    &lt;li&gt;TenButtons &lt;/li&gt;    &lt;li&gt;ElevenButtons &lt;/li&gt;    &lt;li&gt;OneFontControl &lt;/li&gt;    &lt;li&gt;OneInRibbonGallery &lt;/li&gt;    &lt;li&gt;InRibbonGalleryAndBigButton &lt;/li&gt;    &lt;li&gt;InRibbonGalleryAndButtons-GalleryScalesFirst &lt;/li&gt;    &lt;li&gt;ButtonGroups &lt;/li&gt;    &lt;li&gt;ButtonGroupsAndInputs &lt;/li&gt;    &lt;li&gt;BigButtonsAndSmallButtonsOrInputs &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Their exact layout can be found at &lt;a href="http://msdn.microsoft.com/en-us/library/dd316927(VS.85).aspx"&gt;Customizing a Ribbon Through Size Definitions and Scaling Policies&lt;/a&gt; on MSDN. &lt;/p&gt;  &lt;h5&gt;Defining Custom Layout Templates &lt;/h5&gt;  &lt;p&gt;Custom layout templates can be defined in two ways: Inline and Standalone.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Standalone definition      &lt;br /&gt;&lt;/u&gt;Standalone means you define the layout once, under the &lt;b&gt;Ribbon.SizeDefinitions&lt;/b&gt; markup element and then use its name in your group definition, exactly like the predefined layout templates. &lt;/p&gt;  &lt;p&gt;For example, we want to define a layout that is consistent with the Microsoft WordPad &amp;quot;Paragraph&amp;quot; group:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image0027_34846CA0.jpg"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image002[7]" alt="clip_image002[7]" src="http://blogs.microsoft.co.il/blogs/arik/clip_image0027_thumb_44638B97.jpg" width="692" height="107" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 8: Microsoft WordPad&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Defining such a layout template in a standalone definition is done like this:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:75902410-8d03-418d-9117-642bda0acadd" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.SizeDefinitions&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;ParagraphLayout&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameMap&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button1&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button2&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button3&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button4&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button5&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button6&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button7&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button8&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button9&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameMap&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;GroupSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Size&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Large&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Row&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button1&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button2&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button3&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button4&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Row&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Row&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button5&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button6&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button7&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button8&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button9&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Row&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;GroupSizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.SizeDefinitions&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Although this looks intimidating, this is actually pretty simple. First, the &lt;b&gt;ControlNameMap&lt;/b&gt; markup element is a definition of placeholders controls used in the layout. In our example we define 9 controls.     &lt;br /&gt;The mapping between controls in the actual group and controls in the template layout is done according to the order of the controls, define in the &lt;b&gt;ControlNameMap &lt;/b&gt;element. &lt;/p&gt;  &lt;p&gt;Then we define the actual layout definition for each group size. This is done in a &lt;b&gt;GroupSizeDefinition&lt;/b&gt; markup element, where we set the &lt;b&gt;Size&lt;/b&gt; attribute to indicate what group scale size we are defining. Remember that different groups&amp;#39; sizes will have different layouts. In our example we define a layout only for the large size. &lt;/p&gt;  &lt;p&gt;Then we use the &lt;b&gt;Row&lt;/b&gt; markup elements to specify that our layout comes in two lines (three lines is the maximum). &lt;/p&gt;  &lt;p&gt;In every row we use &lt;b&gt;ControlGroup&lt;/b&gt; elements to specify grouping of controls. Controls which are in the same group have no spacing between them. &lt;/p&gt;  &lt;p&gt;Using the standalone custom layout is very simple:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:810668e8-9227-469f-8e6d-c1ea6857627f" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupParagraph&amp;quot;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;ParagraphLayout&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdDecreaseIndent&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdIncreaseIndent&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButton&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdStartList&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButton&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DropDownButton&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdLineSpacing&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DropDownButton&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdAlignLeft&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdAlignCenter&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdAlignRight&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdJustify&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdParagraph&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image0019_57749276.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image001[9]" alt="clip_image001[9]" src="http://blogs.microsoft.co.il/blogs/arik/clip_image0019_thumb_7BB976F8.png" width="147" height="106" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 9: ParagraphLayout custom layout template&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Inline definition      &lt;br /&gt;&lt;/u&gt;Inline means you write the custom layout definition inside your actual group definition, instead of in a general place where it can serve other groups. &lt;/p&gt;  &lt;p&gt;Here is the same example as before, only now we use an inline version of the custom layout template:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:b9df6e41-a8df-4051-9b0a-b067d5798e15" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupParagraph&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameMap&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button1&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button2&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button3&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button4&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button5&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button6&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button7&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button8&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button9&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlNameMap&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;GroupSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Size&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Large&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Row&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button1&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button2&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button3&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button4&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Row&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Row&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button5&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button6&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button7&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button8&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlSizeDefinition&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ControlName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button9&amp;quot;&lt;/span&gt;&lt;br /&gt;                                           &lt;span style="color:#ff0000;"&gt; IsLabelVisible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ControlGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Row&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;GroupSizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdDecreaseIndent&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdIncreaseIndent&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButton&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdStartList&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButton&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DropDownButton&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdLineSpacing&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DropDownButton&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdAlignLeft&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdAlignCenter&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdAlignRight&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdJustify&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdParagraph&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;h3&gt;Arranging Controls in the Application Menu&lt;/h3&gt;  &lt;p&gt;Every ribbon application has an application menu. It is used as the main menu for the application and can be access via a button located on the left of the tabs.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image00111_0BE53EF2.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image001[11]" alt="clip_image001[11]" src="http://blogs.microsoft.co.il/blogs/arik/clip_image00111_thumb_252CF692.png" width="543" height="217" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 10: Application menu button in Microsoft Paint&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The application menu button opens up a drop down menu that can contain various button like ribbon controls. Note that not all of the ribbon controls can be used in the application menu.&lt;/p&gt;  &lt;h4&gt;Defining Application Menu in Ribbon Markup&lt;/h4&gt;  &lt;p&gt;Defining an application menu in the ribbon markup is extremely simple:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:282ad139-5dc9-464e-834e-c4cce6d04d1f" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.ApplicationMenu&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ApplicationMenu&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;MajorItems&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonNew&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonOpen&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonSave&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;MajorItems&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonExit&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ApplicationMenu&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.ApplicationMenu&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;In this example we define an application menu that contains two menu groups and four buttons. &lt;/p&gt;  &lt;p&gt;We use the &lt;b&gt;MenuGroup&lt;/b&gt; markup element to group the buttons into logical groups. This creates a separator between the groups, as shown in the following image:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image00113_57ECD739.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image001[13]" alt="clip_image001[13]" src="http://blogs.microsoft.co.il/blogs/arik/clip_image00113_thumb_540EE6CF.png" width="613" height="319" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 11: Application menu with menu groups&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The &lt;b&gt;MenuGroup&lt;/b&gt; markup element has a single attribute, named &lt;b&gt;Class&lt;/b&gt;, which can have the value &lt;b&gt;StandardItems&lt;/b&gt; or &lt;b&gt;MajorItems&lt;/b&gt;. This attribute controls the size of the elements in the menu group. &lt;/p&gt;  &lt;p&gt;For example, using the following ribbon markup:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1876f0a9-889e-48b4-9cfd-5a017782e0fb" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.ApplicationMenu&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ApplicationMenu&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;StandardItems&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonNew&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonOpen&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonSave&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;StandardItems&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonExit&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ApplicationMenu&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.ApplicationMenu&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;We get the result:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image00115_10670FE0.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image001[15]" alt="clip_image001[15]" src="http://blogs.microsoft.co.il/blogs/arik/clip_image00115_thumb_75AA4DF9.png" width="576" height="216" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 12: Application menu with menu group of class StandardItems&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Another nice UI tweak we can do using a &lt;b&gt;MenuGroup&lt;/b&gt; element is set a title for the group. This is done by attaching a command to the &lt;b&gt;MenuGroup&lt;/b&gt; element; the title will be defined according to the &lt;b&gt;LabelTitle&lt;/b&gt; attribute of the command. &lt;/p&gt;  &lt;p&gt;The end result looks like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image0024_272595C2.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image002[4]" alt="clip_image002[4]" src="http://blogs.microsoft.co.il/blogs/arik/clip_image0024_thumb_11B7BA8D.png" width="567" height="359" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 13: Application menu with menu group titles&lt;/strong&gt;&lt;/p&gt;  &lt;h4&gt;Defining Sub-Menus in Ribbon Markup&lt;/h4&gt;  &lt;p&gt;Defining sub-menus is done by using two buttons we already know from the previous post, namely, &lt;b&gt;DropDownButton&lt;/b&gt; and &lt;b&gt;SplitButton&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;Each of them can contain a list of buttons, and as seen before, the difference between the two is that &lt;b&gt;DropDownButton&lt;/b&gt; is not a button itself but only a container of such, and &lt;b&gt;SplitButton&lt;/b&gt; is both a button and a container of buttons. &lt;/p&gt;  &lt;p&gt;Following is an example for creating a sub-menu using a DropDownButton:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:34494a2f-4117-4e2a-ba63-64dee3676683" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.ApplicationMenu&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ApplicationMenu&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;MajorItems&amp;quot;&lt;/span&gt;&lt;br /&gt;                           &lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdMenuGroupFile&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonNew&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonOpen&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonSave&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DropDownButton&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdDropDownButton&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;MajorItems&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonMoreA&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonMoreB&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonMoreC&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DropDownButton&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;MajorItems&amp;quot;&lt;/span&gt;&lt;br /&gt;                           &lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdMenuGroupExit&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonExit&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ApplicationMenu&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.ApplicationMenu&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The result is shown in the following image:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image00117_086B597F.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image001[17]" alt="clip_image001[17]" src="http://blogs.microsoft.co.il/blogs/arik/clip_image00117_thumb_0FE6A31F.png" width="492" height="414" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 14: Application menu with sub-menus&lt;/strong&gt;&lt;/p&gt;  &lt;h4&gt;Setting shortcuts to menu items &lt;/h4&gt;  &lt;p&gt;Setting a key shortcut for a menu item is done by adding “&amp;amp;amp;&amp;quot; in the &lt;b&gt;LabelTitle&lt;/b&gt; attribute before the letter you want to use as a shortcut (similar to shortcuts in the “old” menu system).     &lt;br /&gt;For example see the &lt;b&gt;LabelTitle&lt;/b&gt; attribute in the following command definition:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:9876eae6-2c10-494f-9da3-7481ef7d6415" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonNew&amp;quot;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#ff0000;"&gt; Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;ID_CMD_NEW&amp;quot;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#ff0000;"&gt; LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;&amp;amp;amp;New&amp;quot;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#ff0000;"&gt; LabelDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;New Description&amp;quot;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#ff0000;"&gt; TooltipTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;New (Ctrl+N)&amp;quot;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#ff0000;"&gt; TooltipDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Create a new image.&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Res/New32.bmp&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Pressing the &lt;b&gt;Alt&lt;/b&gt; key will now add an underscore under the letter and a small box with the letter in it, as shown in the next image:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image00119_24A875D2.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image001[19]" alt="clip_image001[19]" src="http://blogs.microsoft.co.il/blogs/arik/clip_image00119_thumb_7CB550A5.png" width="490" height="403" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 15: Application menu with key modifiers&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Note that this way of setting key shortcuts is only valid in the application menu.    &lt;br /&gt;For setting key shortcuts on ribbon controls in the tabs and groups you should set the &lt;b&gt;Keytip&lt;/b&gt; attribute of the attached command.&lt;/p&gt;  &lt;p&gt;You can find the full code of the sample application used in this post &lt;a href="http://blogs.microsoft.co.il/blogs/arik/RibbonPost4Demo.zip"&gt;here&lt;/a&gt;&lt;u&gt;.&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;/u&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image003_514109DE.jpg"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image003" alt="clip_image003" src="http://blogs.microsoft.co.il/blogs/arik/clip_image003_thumb_354FD4E6.jpg" width="691" height="178" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 16: Sample application for this post&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In this post we have learned how to layout UI controls on the ribbon. We&amp;#39;ve seen how to define groups and tabs, what tab scaling policy is, how to use predefined layouts and how to define custom layouts. Finally, we have seen what the application menu is and how to use it in a ribbon enabled application.&lt;/p&gt;  &lt;p&gt;That&amp;#39;s it for now,    &lt;br /&gt;Arik Poznanski.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/15/ribbon-with-c-part-4-layout-controls-in-windows-ribbon-framework.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/15/ribbon-with-c-part-4-layout-controls-in-windows-ribbon-framework.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/15/ribbon-with-c-part-4-layout-controls-in-windows-ribbon-framework.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/15/ribbon-with-c-part-4-layout-controls-in-windows-ribbon-framework.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=172641" rel="tag" style="display:none;"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=842946" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/COM/default.aspx">COM</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2B002B00_/default.aspx">C++</category></item><item><title>Ribbon with C++, Part 3: Using Buttons with Windows Ribbon Framework</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/13/ribbon-with-c-part-3-using-buttons-with-windows-ribbon-framework.aspx</link><pubDate>Mon, 13 Jun 2011 05:57:45 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:842418</guid><dc:creator>arik</dc:creator><slash:comments>9</slash:comments><description>&lt;p&gt;On previous posts we have seen an &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/03/ribbon-with-c-part-1-introduction-to-the-windows-ribbon-framework.aspx"&gt;introduction&lt;/a&gt; to the &lt;strong&gt;Windows Ribbon Framework&lt;/strong&gt; and learned how to &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/06/ribbon-with-c-part-2-first-ribbon-enabled-application.aspx"&gt;develop a ribbon enabled application&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;In this post we continue our review of the various features in the Windows Ribbon Framework. This time we will focus on the most common feature in the ribbon: Buttons.&lt;/p&gt;  &lt;p&gt;I assume the concept of a button needs no introduction; however, there are several kinds of buttons available with the Windows Ribbon Framework and in this post we will review them.&lt;/p&gt;  &lt;p&gt;But first, let&amp;#39;s dive into the details of how we use the ribbon in an application.    &lt;br /&gt;The important parts are to define the ribbon user interface using the ribbon markup and then implement handlers for the UI we used.&lt;/p&gt;  &lt;p&gt;The ribbon markup is composed of two main sections, &lt;b&gt;Commands&lt;/b&gt; and &lt;b&gt;Views&lt;/b&gt;.&lt;/p&gt;  &lt;h3&gt;Commands and Views &lt;/h3&gt;  &lt;p&gt;A command is an action that is identified by a number. It can be opening the save-as dialog, printing the current document, closing the application, etc. every thing you can do in a function call.&lt;/p&gt;  &lt;p&gt;A view is a graphical representation of [usually several] commands. It defines the type of controls used to activate the commands, their size, order and layout on the screen.&lt;/p&gt;  &lt;p&gt;So using commands and views is actually just another instance of the well-known MVC design pattern, which allows us to separate business logic from presentation logic.&lt;/p&gt;  &lt;p&gt;The basic template for all ribbon markup files looks like this:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cefb0896-2419-4b03-ab2e-34a9f48d131a" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;?xml version=&amp;#39;1.0&amp;#39; encoding=&amp;#39;utf-8&amp;#39;?&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;http://schemas.microsoft.com/windows/2009/Ribbon&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Commands&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;...&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Commands&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;...&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;h4&gt;Commands Section&lt;/h4&gt;  &lt;p&gt;In the &lt;b&gt;Commands&lt;/b&gt; section we define, well, commands. Every command is defined in its own &lt;b&gt;Command&lt;/b&gt; XML element.&lt;/p&gt;  &lt;p&gt;Following is a common definition for a command:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7ec2ef0e-417c-40a0-9719-a309c3aa92ed" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonNew&amp;quot;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#ff0000;"&gt; Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;ID_CMD_NEW&amp;quot;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#ff0000;"&gt; Id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;1001&amp;quot;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#ff0000;"&gt; LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;New&amp;quot;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#ff0000;"&gt; LabelDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;New Description&amp;quot;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#ff0000;"&gt; TooltipTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;New&amp;quot;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#ff0000;"&gt; TooltipDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Create a new image.&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Res/New32.bmp&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.SmallImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Res/New16.bmp&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.SmallImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;In this example we define a command that will encapsulate the &amp;quot;New&amp;quot; button functionality.&lt;/p&gt;  &lt;h4&gt;Command Properties&lt;/h4&gt;  &lt;p&gt;The &lt;b&gt;Command&lt;/b&gt; XML element has several properties, we divide them to categories:&lt;/p&gt;  &lt;h5&gt;Properties used for referencing the command: &lt;/h5&gt;  &lt;p&gt;The&lt;b&gt; Name&lt;/b&gt; attribute is used to reference this command in the markup, for example, in order to attach a button with this command.&lt;/p&gt;  &lt;p&gt;The &lt;b&gt;Symbol&lt;/b&gt; attribute represents the name of the constant that will reference this command, later, when we will write the command handler code.&lt;/p&gt;  &lt;p&gt;The &lt;b&gt;Id&lt;/b&gt; attribute is just a way to control what the constant value will be.&lt;/p&gt;  &lt;h5&gt;Properties used for defining command related resources:&lt;/h5&gt;  &lt;p&gt;The &lt;b&gt;LabelTitle&lt;/b&gt; attribute is used to define the label title of the command.     &lt;br /&gt;The &lt;b&gt;LabelDescription&lt;/b&gt; attribute is used to define the label description of the command.     &lt;br /&gt;The &lt;b&gt;TooltipTitle&lt;/b&gt; attribute is used to define the tooltip title of the command.     &lt;br /&gt;The &lt;b&gt;TooltipDescription&lt;/b&gt; attribute is used to define the tooltip description of the command.     &lt;br /&gt;The &lt;b&gt;LargeImages&lt;/b&gt; attribute is used to define the large image filename for the command, usually 32x32 pixels.     &lt;br /&gt;The &lt;b&gt;SmallImages&lt;/b&gt; attribute is used to define the small image filename for the command, usually 16x16 pixels.&lt;/p&gt;  &lt;h5&gt;Setting image resources in ribbon markup &lt;/h5&gt;  &lt;p&gt;The filename defined in the markup (like in the &lt;b&gt;LargeImages&lt;/b&gt; and &lt;b&gt;SmallImages&lt;/b&gt; XML element), should be a valid (relative or full) path to a filename, otherwise the Visual C++ Resource Compiler (rc.exe) will output a compilation error: “error RC2135: file not found: &amp;lt;filename&amp;gt;”.&lt;/p&gt;  &lt;p&gt;The image file format should be BMP with 32 BPP ARGB pixel format. Many image editing programs, like Microsoft Paint do not preserve the highest order 8-bit alpha channel when saving, thus creating only 24 bit images, the result is that the image will not appear at all. &lt;/p&gt;  &lt;p&gt;You can use the tool &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2009/10/04/how-to-convert-an-image-to-32-bit-bmp.aspx"&gt;convert2bmp&lt;/a&gt; to convert your images to the required format.&lt;/p&gt;  &lt;p&gt;Under both images elements you can put several image files in different sizes, the ribbon framework will choose the best size according to the current DPI setting. For us, normal users, setting two images for 32x32 and 16x16 should be enough. For more information, see &amp;quot;&lt;a href="http://msdn.microsoft.com/en-us/library/dd316921(VS.85).aspx"&gt;Specifying Ribbon Image Resources&lt;/a&gt;&amp;quot; on MSDN.&lt;/p&gt;  &lt;h4&gt;Views Section&lt;/h4&gt;  &lt;p&gt;The &lt;b&gt;Views&lt;/b&gt; section defines the UI controls we want to use, and their layout in the ribbon.     &lt;br /&gt;Following is a definition for a view which has a tab, a group and a single button:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1e2d6b59-b34e-4434-a3fc-7b296bd25448" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdTabMain&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupFileActions&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonNew&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The views syntax is somewhat self-explanatory, we use the &lt;b&gt;Tab&lt;/b&gt; element to define a tab, a &lt;b&gt;Group&lt;/b&gt; element to define a group and a &lt;b&gt;Button&lt;/b&gt; element to define a button. &lt;/p&gt;  &lt;p&gt;The &lt;b&gt;CommandName&lt;/b&gt; attribute is used to bind a UI element to a given command (along with its resources. In this example, our button will be bound to the predefined &lt;b&gt;cmdButtonNew&lt;/b&gt; command element. This means our button will have the label title, tooltip and images of this command.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h4&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image001_4387BEA5.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image001" alt="clip_image001" src="http://blogs.microsoft.co.il/blogs/arik/clip_image001_thumb_66F43D3D.png" width="329" height="246" /&gt;&lt;/a&gt;&lt;/h4&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 1: Button with command resources&lt;/strong&gt;&lt;/p&gt;  &lt;h3&gt;Handling &amp;quot;Button Clicked&amp;quot; Event&lt;/h3&gt;  &lt;p&gt;As we&amp;#39;ve seen in the previous post, handling the button click event is done by implementing the &lt;b&gt;IUICommandHandler::Execute &lt;/b&gt;function, of the &lt;b&gt;IUICommandHandler&lt;/b&gt; instance provided by &lt;b&gt;IUIApplication&lt;/b&gt; for the given command id.&lt;/p&gt;  &lt;p&gt;Following is an example where in responds to the click on the &amp;quot;New&amp;quot; button we show a message box to the screen:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a03dd927-8ade-44e6-9f65-7462ef5e3584" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#008000;"&gt;// Called by the Ribbon framework when a command is executed by the user.  &lt;/span&gt;&lt;br /&gt; &lt;span style="color:#008000;"&gt;// For example, when a button is pressed.&lt;/span&gt;&lt;br /&gt; STDMETHODIMP CCommandHandler::Execute(&lt;br /&gt;     UINT nCmdID,&lt;br /&gt;     UI_EXECUTIONVERB verb,&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPERTYKEY* key,&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPVARIANT* ppropvarValue,&lt;br /&gt;     IUISimplePropertySet* pCommandExecutionProperties)&lt;br /&gt; {&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;switch&lt;/span&gt; (nCmdID)&lt;br /&gt;     {&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; ID_CMD_NEW:&lt;br /&gt;         MessageBox(GetForegroundWindow(),&lt;br /&gt;                           L&lt;span style="color:#a31515;"&gt;&amp;quot;New button was clicked&amp;quot;&lt;/span&gt;, L&lt;span style="color:#a31515;"&gt;&amp;quot;New Clicked&amp;quot;&lt;/span&gt;, 0);&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt; &lt;br /&gt;     }&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; S_OK;&lt;br /&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Few things we should note here:&lt;/p&gt;  &lt;p&gt;The first parameter, &lt;b&gt;nCmdID&lt;/b&gt;, is the id of the command which is bound to the button. In our case, we define this id to be 1001 (using the &lt;b&gt;Id&lt;/b&gt; attribute of the command).&lt;/p&gt;  &lt;p&gt;The second parameter, &lt;b&gt;verb&lt;/b&gt;, usually has the value &lt;b&gt;UI_EXECUTIONVERB_EXECUTE&lt;/b&gt;. Two other values it can have are: &lt;b&gt;UI_EXECUTIONVERB_PREVIEW&lt;/b&gt; and &lt;b&gt;UI_EXECUTIONVERB_CANCELPREVIEW&lt;/b&gt;, These values are used with ribbon galleries.&lt;/p&gt;  &lt;p&gt;The other parameters are not used in this context.&lt;/p&gt;  &lt;h3&gt;Other Button Types&lt;/h3&gt;  &lt;p&gt;Up until now we have seen the most common button type, which is available to us by using the &lt;b&gt;&amp;lt;Button&amp;gt;&lt;/b&gt; XML element.&lt;/p&gt;  &lt;p&gt;We will see now a few more types of buttons, the main difference between the different types are their GUI representations.    &lt;br /&gt;In fact, all of these buttons are used in the exact same way:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Declare them in the ribbon markup &lt;/li&gt;    &lt;li&gt;Implement IUICommandHandler::Execute &lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;&lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h4&gt;Using HelpButton&lt;/h4&gt;  &lt;p&gt;The &lt;b&gt;HelpButton&lt;/b&gt; is a button with a specific GUI. It always has the same predefined image and is always positioned in the same place in the ribbon. Also, there can be at most one help-button in the ribbon.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image002_72E607A4.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image002" alt="clip_image002" src="http://blogs.microsoft.co.il/blogs/arik/clip_image002_thumb_2FBA8977.png" width="374" height="199" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 2: Help button&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Note that despite its name, it doesn&amp;#39;t have to handle any help-related functionality.    &lt;br /&gt;That being said, it is recommended you provide help information using this button, to maintain a consistent user experience with other windows applications.&lt;/p&gt;  &lt;p&gt;To use a &lt;b&gt;HelpButton&lt;/b&gt; in your application you need to use the following ribbon markup:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:b7d5a16b-3add-400b-8ef6-36da6c6f397d" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.HelpButton&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;HelpButton&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdHelpButton&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.HelpButton&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;?&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;In this case, since the &lt;b&gt;HelpButton&lt;/b&gt; requires no resources, the command declaration is as simple as:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:508332de-6d57-4896-aaae-837c79b5b215" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdHelpButton&amp;quot;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#ff0000;"&gt; Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;ID_CMD_HELP&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h4&gt;Using SplitButton and DropDownButton&lt;/h4&gt;  &lt;p&gt;&lt;b&gt;SplitButton&lt;/b&gt; and &lt;b&gt;DropDownButton&lt;/b&gt; are both ribbon UI controls which can hold several buttons and which shows these buttons upon clicking on a small arrow button:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image003_270A0B1E.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image003" alt="clip_image003" src="http://blogs.microsoft.co.il/blogs/arik/clip_image003_thumb_754EEDC8.png" width="301" height="316" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 3: SplitButton that contains three buttons&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;So what is actually the difference between these two?&lt;/p&gt;  &lt;p&gt;Well, the difference between them is that &lt;b&gt;DropDownButton&lt;/b&gt; is in fact NOT a button.     &lt;br /&gt;This means that clicking on a &lt;b&gt;DropDownButton&lt;/b&gt; only shows the buttons list, but doesn&amp;#39;t run any custom code. &lt;/p&gt;  &lt;p&gt;On the other hand, &lt;b&gt;SplitButton&lt;/b&gt; is itself a button, which you can respond to. A click on the arrow part will cause it to show the buttons list.&lt;/p&gt;  &lt;p&gt;The common use for a &lt;b&gt;DropDownButton&lt;/b&gt; is when you want to expose a set of items which doesn&amp;#39;t have an obvious default option. For example, consider the “Rotate” feature in Microsoft Paint. You can rotate by 90, 180 and 270 degrees, but none of these options is an obvious default.&lt;/p&gt;  &lt;p&gt;The common use for a &lt;b&gt;SplitButton&lt;/b&gt; is when you want to expose a set of items which have an obvious default option. For example, consider the “Save As” button in an application that supports several file-format but does have an obvious default save format.&lt;/p&gt;  &lt;p&gt;The following example shows how to define both &lt;b&gt;DropDownButton&lt;/b&gt; and &lt;b&gt;SplitButton&lt;/b&gt; in a ribbon application:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:44144a11-e805-43a7-af3d-4a43211346d8" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdTabMain&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupFileActions&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;ThreeButtons&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdButtonNew&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DropDownButton&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdDropDownButton&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;MajorItems&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonMoreA&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonMoreB&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonMoreC&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DropDownButton&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButton&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButton.ButtonItem&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonMoreB&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButton.ButtonItem&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButton.MenuGroups&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;MajorItems&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;                                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonMoreA&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonMoreB&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;#39;cmdButtonMoreC&amp;#39; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;MenuGroup&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButton.MenuGroups&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SplitButton&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Note that in the &lt;b&gt;DropDownButton&lt;/b&gt; XML element you define only the buttons in the buttons list. On the other hand, the &lt;b&gt;SplitButton&lt;/b&gt; XML element contains a definition for both the buttons list and a specific default button (defined in the &lt;b&gt;SplitButton.ButtonItem&lt;/b&gt; element).&lt;/p&gt;  &lt;p&gt;The commands bound to these buttons are defined and handled similarly to the commands we already saw.&lt;/p&gt;  &lt;h3&gt;CheckBox and ToggleButton&lt;/h3&gt;  &lt;p&gt;&lt;b&gt;CheckBox&lt;/b&gt; and &lt;b&gt;ToggleButton&lt;/b&gt; are two ribbon UI controls that represent a button with a Boolean state. The sole difference between the two is their GUI representation. The Toggle button looks like a button that remains pressed until pressed again. The Checkbox control looks like the familiar checkbox control we all know and love: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image004_3DD8B6CD.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image004" alt="clip_image004" src="http://blogs.microsoft.co.il/blogs/arik/clip_image004_thumb_1BA0AB47.png" width="205" height="122" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 4: Toggle button and check box&lt;/strong&gt;&lt;/p&gt;  &lt;h4&gt;Using CheckBox and ToggleButton&lt;/h4&gt;  &lt;p&gt;Following is an example of ribbon markup that defines both a &lt;b&gt;ToggleButton&lt;/b&gt; and a &lt;b&gt;CheckBox&lt;/b&gt;:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cb17199f-287d-446f-8038-c5acc3914986" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdTabMain&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupToggleButton&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;OneButton&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ToggleButton&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdToggleButton&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdGroupCheckBox&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;CheckBox&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;cmdCheckBox&amp;quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;What&amp;#39;s left for us to know is how to handle the &amp;quot;Checked Changed&amp;quot; event and how to get the current value of the CheckBox / ToggleButton.&lt;/p&gt;  &lt;h4&gt;Handling &amp;quot;Checked Changed&amp;quot; Event&lt;/h4&gt;  &lt;p&gt;Handling the &amp;quot;Checked Changed&amp;quot; event is done exactly the same way we handled the &amp;quot;Button Clicked&amp;quot; event, that is, by implementing &lt;b&gt;IUICommandHandler::Execute function&lt;/b&gt;.&lt;/p&gt;  &lt;p&gt;In order to get the current Boolean value of the CheckBox we use another function that &lt;b&gt;IUIFramework&lt;/b&gt; provides, namely, &lt;b&gt;IUIFramework::GetUICommandProperty&lt;/b&gt;.     &lt;br /&gt;This &lt;b&gt;GetUICommandProperty&lt;/b&gt; function receives three parameters.     &lt;br /&gt;The first is the command id we need the property from, in our sample it is &lt;b&gt;ID_CMD_TOGGLE_BUTTON&lt;/b&gt;, which is defined in the auto-generated file &lt;b&gt;RibbonIds.h.&lt;/b&gt; The second parameter is the id of the property we want to get, in this case it has the value &lt;b&gt;UI_PKEY_BooleanValue&lt;/b&gt;, which is defined in &lt;b&gt;UIRibbon.h&lt;/b&gt; (comes with Windows SDK).     &lt;br /&gt;The last parameter is the return value of the property.&lt;/p&gt;  &lt;p&gt;Setting the value of a property is done similarly using &lt;b&gt;IUIFramework::SetUICommandProperty&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;In the following example we show the previous concepts by handling the &amp;quot;Checked Changed&amp;quot; event of a toggle button. We get the Boolean value of the toggle button, negate it and set it as the Enable property of the checkbox:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1069f52f-b6ad-4bbf-9e2e-f16990ba4f46" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;STDMETHODIMP CCommandHandler::Execute(&lt;br /&gt;     UINT nCmdID,&lt;br /&gt;     UI_EXECUTIONVERB verb,&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPERTYKEY* key,&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPVARIANT* ppropvarValue,&lt;br /&gt;     IUISimplePropertySet* pCommandExecutionProperties)&lt;br /&gt; {&lt;br /&gt;     HRESULT hr;&lt;br /&gt;     HWND hwnd = GetForegroundWindow();&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;switch&lt;/span&gt; (nCmdID)&lt;br /&gt;     {&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; ID_CMD_TOGGLE_BUTTON:&lt;br /&gt;         BOOL boolValue;&lt;br /&gt;         PROPVARIANT var, varNew;&lt;br /&gt; &lt;br /&gt;         hr = g_pFramework-&amp;gt;GetUICommandProperty(ID_CMD_TOGGLE_BUTTON,&lt;br /&gt;                                                        UI_PKEY_BooleanValue, &amp;amp;var); &lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (FAILED(hr))&lt;br /&gt;         {&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; hr;&lt;br /&gt;         }&lt;br /&gt; &lt;br /&gt;         hr = PropVariantToBoolean(var, &amp;amp;boolValue);&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (FAILED(hr))&lt;br /&gt;         {&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; hr;&lt;br /&gt;         } &lt;br /&gt; &lt;br /&gt;         boolValue = !boolValue;&lt;br /&gt;         hr = UIInitPropertyFromBoolean(UI_PKEY_Enabled, boolValue, &amp;amp;varNew);&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (FAILED(hr))&lt;br /&gt;         {&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; hr;&lt;br /&gt;         }&lt;br /&gt; &lt;br /&gt;         hr = g_pFramework-&amp;gt;SetUICommandProperty(ID_CMD_CHECK_BOX, &lt;br /&gt;                      UI_PKEY_Enabled, varNew);&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (FAILED(hr))&lt;br /&gt;         {&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; hr;&lt;br /&gt;         }&lt;br /&gt; &lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt;     }&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; S_OK;&lt;br /&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The &lt;b&gt;UIInitPropertyFromBoolean&lt;/b&gt; is just a helper function, defined in &lt;b&gt;UIRibbonPropertyHelpers.h&lt;/b&gt;, which sets a &lt;b&gt;PROPVARIANT&lt;/b&gt; variable with a Boolean value and does a compile time check, on the way, to make sure the property is of Boolean type.&lt;/p&gt;  &lt;h4&gt;Implementing UpdateProperty&lt;/h4&gt;  &lt;p&gt;On the previous section we saw that to set the value of properties we can use the function &lt;b&gt;IUIFramework::SetUICommandProperty&lt;/b&gt;. Actually this only works for part of the properties. Other properties are set in a different way, by implementing &lt;b&gt;IUICommandHandler::UpdateProperty&lt;/b&gt;, which we shall review now.     &lt;br /&gt;The details of which properties is can be changed using &lt;b&gt;SetUICommandProperty&lt;/b&gt; and which can be changed only using &lt;b&gt;UpdateProperty&lt;/b&gt; are part of the MSDN documentation of each ribbon UI control.&lt;/p&gt;  &lt;p&gt;The second way for updating properties is a two steps process:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;First, call &lt;b&gt;IUIFramework::InvalidateUICommand&lt;/b&gt;, passing the command id and the property id which should be invalidated. &lt;/li&gt;    &lt;li&gt;Second, implement &lt;b&gt;IUICommandHandler::UpdateProperty&lt;/b&gt;. This function will get as parameters the command id and property id which is needed by the framework and you should return its value. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Note that the function &lt;b&gt;IUICommandHandler::UpdateProperty&lt;/b&gt; might not get called immediately after calling &lt;b&gt;IUIFramework::InvalidateUICommand&lt;/b&gt;. It will be called only when the ribbon framework will actually need the property value. &lt;/p&gt;  &lt;p&gt;In the following example we show first how to call the &lt;b&gt;InvalidateUICommand&lt;/b&gt; function and how to implement UpdateProperty so that the text of the checkbox changes according to the state of the toggle button:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:38391de6-2485-4565-908c-ffb7114970f5" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;STDMETHODIMP CCommandHandler::Execute(&lt;br /&gt;     UINT nCmdID,&lt;br /&gt;     UI_EXECUTIONVERB verb,&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPERTYKEY* key,&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPVARIANT* ppropvarValue,&lt;br /&gt;     IUISimplePropertySet* pCommandExecutionProperties)&lt;br /&gt; {&lt;br /&gt;     ...&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#008000;"&gt;// invalidate checkbox label&lt;/span&gt;&lt;br /&gt;     hr = g_pFramework-&amp;gt;InvalidateUICommand(ID_CMD_CHECK_BOX,&lt;br /&gt;                                            UI_INVALIDATIONS_PROPERTY,&lt;br /&gt;                                            &amp;amp;UI_PKEY_Label);&lt;br /&gt;     ...&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; S_OK;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; STDMETHODIMP CCommandHandler::UpdateProperty(&lt;br /&gt;     UINT nCmdID,&lt;br /&gt;     REFPROPERTYKEY key,&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPVARIANT* ppropvarCurrentValue,&lt;br /&gt;     PROPVARIANT* ppropvarNewValue)&lt;br /&gt; {&lt;br /&gt;     HRESULT hr = E_FAIL;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (key == UI_PKEY_Label)&lt;br /&gt;     {&lt;br /&gt;         &lt;span style="color:#008000;"&gt;// update the Label of the toggle button&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (nCmdID == ID_CMD_CHECK_BOX)&lt;br /&gt;         {&lt;br /&gt;             BOOL boolValue;&lt;br /&gt;             PROPVARIANT var;&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#008000;"&gt;// get boolean value from toggle button&lt;/span&gt;&lt;br /&gt;             hr = g_pFramework-&amp;gt;GetUICommandProperty(ID_CMD_TOGGLE_BUTTON,&lt;br /&gt;                                         UI_PKEY_BooleanValue, &amp;amp;var); &lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (FAILED(hr))&lt;br /&gt;             {&lt;br /&gt;                 &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; hr;&lt;br /&gt;             }&lt;br /&gt; &lt;br /&gt;             hr = PropVariantToBoolean(var, &amp;amp;boolValue);&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (FAILED(hr))&lt;br /&gt;             {&lt;br /&gt;                 &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; hr;&lt;br /&gt;             }&lt;br /&gt; &lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (boolValue)&lt;br /&gt;             {&lt;br /&gt;                 hr = UIInitPropertyFromString(UI_PKEY_Label, &lt;br /&gt;                                             L&lt;span style="color:#a31515;"&gt;&amp;quot;Checkbox Disabled&amp;quot;&lt;/span&gt;, &lt;br /&gt;                                             ppropvarNewValue);&lt;br /&gt;             }&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;else&lt;/span&gt;&lt;br /&gt;             {&lt;br /&gt;                 hr = UIInitPropertyFromString(UI_PKEY_Label, &lt;br /&gt;                                             L&lt;span style="color:#a31515;"&gt;&amp;quot;Checkbox Enabled&amp;quot;&lt;/span&gt;,&lt;br /&gt;                                             ppropvarNewValue);&lt;br /&gt;             }&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt; &lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; hr;&lt;br /&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;You can find the full code of the sample application used in this post &lt;a href="http://blogs.microsoft.co.il/blogs/arik/RibbonPost3Demo.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image005_0B45338E.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image005" alt="clip_image005" src="http://blogs.microsoft.co.il/blogs/arik/clip_image005_thumb_2D00E652.png" width="480" height="176" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 5: Sample application for this post&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In this post we have learned about the commands and views sections in the markup. We&amp;#39;ve reviewed what different types of buttons are provided by the ribbon framework, and how to use them. Finally, we saw how to get and set properties values of ribbon UI controls.&lt;/p&gt;  &lt;p&gt;That&amp;#39;s it for now,    &lt;br /&gt;Arik Poznanski.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/13/ribbon-with-c-part-3-using-buttons-with-windows-ribbon-framework.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/13/ribbon-with-c-part-3-using-buttons-with-windows-ribbon-framework.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/13/ribbon-with-c-part-3-using-buttons-with-windows-ribbon-framework.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/13/ribbon-with-c-part-3-using-buttons-with-windows-ribbon-framework.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=172641" rel="tag" style="display:none;"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=842418" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/COM/default.aspx">COM</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2B002B00_/default.aspx">C++</category></item><item><title>Ribbon with C++, Part 2: First Ribbon Enabled Application</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/06/ribbon-with-c-part-2-first-ribbon-enabled-application.aspx</link><pubDate>Mon, 06 Jun 2011 17:51:44 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:841156</guid><dc:creator>arik</dc:creator><slash:comments>12</slash:comments><description>&lt;p&gt;In this post we continue our review of the Windows Ribbon Framework feature brought to us in Windows 7. For more information on the ribbon feature in general and Windows Ribbon Framework in particular, make sure you read &lt;a href="http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/03/ribbon-with-c-part-1-introduction-to-the-windows-ribbon-framework.aspx"&gt;Part 1&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Today we will see how to create a ribbon enabled application in C++ using the &lt;strong&gt;Windows Ribbon Framework&lt;/strong&gt;. To show it we will build a small application with a ribbon that will contain two tabs, three groups and several buttons.&lt;/p&gt;  &lt;p&gt;As mentioned in the previous post, there are four steps we need to follow in order to create a ribbon enabled application. Let&amp;#39;s dive into the details of these steps.&lt;/p&gt;  &lt;p&gt;One last note before we start, this post requires knowledge in both Win32 and COM development. Also, if you wish to compile the sample application attached to this post, make sure you have &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&amp;amp;displaylang=en"&gt;Windows 7 SDK&lt;/a&gt; installed.&lt;/p&gt;  &lt;h3&gt;Step 1: Define the Ribbon UI&lt;/h3&gt;  &lt;p&gt;The first thing to do is to declare the ribbon user interface. This is done by creating an XML file that will contain the ribbon UI definition using a XAML-based syntax.&lt;/p&gt;  &lt;p&gt;For our demo application, let&amp;#39;s create a file named &lt;b&gt;RibbonMarkup.xml&lt;/b&gt; (the XML suffix is not mandatory but is still recommended), with the following content:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ef1d524e-825e-4cc4-909a-e72f83e8711a" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#a31515;"&gt;xml&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;version&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;#39;&lt;span style="color:#0000ff;"&gt;1.0&lt;/span&gt;&amp;#39;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;encoding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;#39;&lt;span style="color:#0000ff;"&gt;utf-8&lt;/span&gt;&amp;#39;&lt;span style="color:#0000ff;"&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;#39;&lt;span style="color:#0000ff;"&gt;http://schemas.microsoft.com/windows/2009/Ribbon&lt;/span&gt;&amp;#39;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Commands&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonNew&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ID_CMD_NEW&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;New&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;New Description&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;TooltipTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;New (Ctrl+N)&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;TooltipDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Create a new image.&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;Res/New32.bmp&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonOpen&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ID_CMD_OPEN&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Open&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Open Description&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;TooltipTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Open (Ctrl+O)&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;TooltipDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Open an existing image.&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;Res/Open32.bmp&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonSave&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ID_CMD_SAVE&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Save&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Save Description&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;TooltipTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Save (Ctrl+S)&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;TooltipDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Save the current image.&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;Res/Save32.bmp&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonExit&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ID_CMD_EXIT&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Exit&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Exit Description&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;TooltipTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Exit (Ctrl+X)&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;TooltipDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Exit application.&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;Res/Exit32.bmp&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonMoreA&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ID_CMD_MORE_A&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;More A&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Sub button A&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;Res/MoreA32.bmp&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonMoreB&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ID_CMD_MORE_B&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;More B&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Sub button B&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;Res/MoreB32.bmp&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonMoreC&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ID_CMD_MORE_C&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;More C&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelDescription&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Sub button C&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;Res/MoreC32.bmp&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Image&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command.LargeImages&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdTabMain&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ID_CMD_TAB_MAIN&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Main&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdTabMore&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ID_CMD_TAB_MORE&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;More&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdGroupFileActions&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ID_CMD_GROUP_FILE&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;File Actions&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdGroupExit&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ID_CMD_GROUP_EXIT&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdGroupMore&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Symbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ID_CMD_MORE&lt;/span&gt;&amp;quot;&lt;br /&gt;              &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LabelTitle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Command&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Commands&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;   &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdTabMain&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;           &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;br /&gt;           &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdGroupFileActions&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ThreeButtons&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonNew&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonOpen&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonSave&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;br /&gt;           &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;br /&gt;           &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdGroupExit&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;OneButton&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonExit&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;br /&gt;           &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;           &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; =&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdTabMore&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;           &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdGroupMore&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;SizeDefinition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;ThreeButtons&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonMoreA&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonMoreB&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdButtonMoreC&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;br /&gt;           &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Tab&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon.Tabs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Ribbon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application.Views&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Application&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Ok, this may look intimidating at first glance, but it is rather easy to understand.    &lt;br /&gt;The ribbon UI definition file has two major sections, &lt;b&gt;Commands&lt;/b&gt; and &lt;b&gt;Views&lt;/b&gt;.&lt;/p&gt;  &lt;p&gt;For now, suffice to say that the &lt;b&gt;Commands&lt;/b&gt; section defines the different actions a user can invoke using the ribbon UI controls. Each such command is defined with its required resources (strings and images). Later, we will write command handlers in the application code. &lt;/p&gt;  &lt;p&gt;The &lt;b&gt;Views&lt;/b&gt; section defines the UI controls we want to use, and their layout in the ribbon. Each UI control is bound to a command and thus will trigger it when the UI control executes (e.g. button clicked).&lt;/p&gt;  &lt;p&gt;More details on the &lt;b&gt;Commands&lt;/b&gt; and &lt;b&gt;Views&lt;/b&gt; sections will be reviewed on the next post.&lt;/p&gt;  &lt;p&gt;A look on the &lt;b&gt;Views&lt;/b&gt; section reveals that in our demo application the ribbon has two tabs; the first tab has two groups and the second tab contains one group. Each group contains some buttons. In other words:&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image001_63D3E00A.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image001" alt="clip_image001" src="http://blogs.microsoft.co.il/blogs/arik/clip_image001_thumb_48BB10FC.png" width="246" height="142" /&gt;&lt;/a&gt;&lt;strong&gt;Figure 1: First tab &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image002_66B91EF0.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image002" alt="clip_image002" src="http://blogs.microsoft.co.il/blogs/arik/clip_image002_thumb_05235FDA.png" width="247" height="142" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 2: Second tab&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;If you try to follow the steps yourself, make sure the images you use are bitmaps (BMP format) that have 32 bits per pixel (32BPP). This is a mandatory need for all images used with the Windows Ribbon Framework.&lt;/p&gt;  &lt;h3&gt;Step 2: Compile Ribbon UI&lt;/h3&gt;  &lt;p&gt;In this step we will see how to use the Ribbon Markup Compiler, provided with Windows 7 SDK, to compile the ribbon markup that we wrote in the previous step, into a compact binary representation of the ribbon UI.&lt;/p&gt;  &lt;p&gt;The compiler executable name is UICC.exe and it can be found at: &lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:9978d65d-6fa8-45ac-b11b-ab3233c8bafa" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;%ProgramFiles%&amp;#92;Microsoft SDKs&amp;#92;Windows&amp;#92;v7.0&amp;#92;Bin&amp;#92;UICC.exe&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;To manually compile the markup, open the Windows SDK &amp;quot;CMD Shell&amp;quot; and run: &lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a8f10df1-f005-4cd6-9a91-7ecf1d83bd6b" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;UICC.exe RibbonMarkup.xml RibbonUI.bml /header:RibbonIDs.h /res:RibbonResource.rc&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;UICC does the following upon run:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Validates the ribbon markup syntax. &lt;/li&gt;    &lt;li&gt;Generates a compressed binary representation of the markup along with a RC file that describes it.      &lt;br /&gt;In our demo, these are the files &lt;b&gt;RibbonUI.bml &lt;/b&gt;and&lt;b&gt; RibbonResource.rc &lt;/b&gt;respectively. &lt;/li&gt;    &lt;li&gt;Generates a C++ header file containing constants for the ribbon identifiers. This will be proved useful when we we&amp;#39;ll implement the command handlers.      &lt;br /&gt;In our demo, it is the file &lt;b&gt;RibbonIDs.h&lt;/b&gt;. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Note that since our ribbon markup is rather light, the compiler will generate warnings about some missing markup elements. These warnings are not important at this point and we can safely ignore them.&lt;/p&gt;  &lt;p&gt;Later, in step 4, we will setup the ribbon markup compilation as a custom build event in our project.&lt;/p&gt;  &lt;h3&gt;Step 3: Write Command Handlers Code&lt;/h3&gt;  &lt;p&gt;In this step we will see how to write code that initialize the Windows Ribbon Framework, loads the previously compiled ribbon UI and responds to events generated by the ribbon UI controls. &lt;/p&gt;  &lt;p&gt;Before we dive into the code, let&amp;#39;s get to know the main players participating in a ribbon enabled application, namely: &lt;b&gt;UIRibbonFramework&lt;/b&gt;, &lt;b&gt;IUIApplication&lt;/b&gt; and &lt;b&gt;IUICommandHandler&lt;/b&gt;.&lt;/p&gt;  &lt;h4&gt;UIRibbonFramework Class&lt;/h4&gt;  &lt;p&gt;&lt;b&gt;UIRibbonFramework&lt;/b&gt; is a COM class provided by the Windows Ribbon Framework, which implements &lt;a href="http://msdn.microsoft.com/en-us/library/dd371467(VS.85).aspx"&gt;&lt;b&gt;IUIFramework&lt;/b&gt;&lt;/a&gt; interface.     &lt;br /&gt;This class is the entry point to the Windows Ribbon Framework. It provides functions for both initializing and destroying the ribbon framework within your application as well as other functions to control the ribbon behavior.&lt;/p&gt;  &lt;p&gt;Its most important functions are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Initialize(HWND topWindow, IUIApplication* application)&lt;/b&gt;       &lt;br /&gt;This function initialize the Windows Ribbon Framework within your application.       &lt;br /&gt;It receives an &lt;b&gt;IUIApplication&lt;/b&gt; interface which we should implement to supply callbacks that the ribbon framework will invoke. More on this interface later. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;LoadUI (HINSTANCE instance, LPCWSTR resourceName)        &lt;br /&gt;&lt;/b&gt;This function loads the ribbon UI resource. After this function gets called, the ribbon control should be visible. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Destroy()&lt;/b&gt;       &lt;br /&gt;This function releases all the object references held by the Windows Ribbon Framework. &lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;&lt;/ul&gt;  &lt;h4&gt;IUIApplication Interface&lt;/h4&gt;  &lt;p&gt;As mentioned before, &lt;a href="http://msdn.microsoft.com/en-us/library/dd371528(VS.85).aspx"&gt;IUIApplication&lt;/a&gt; is an interface that our application should implement. It provides three callbacks that the ribbon framework will invoke when needed.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;OnCreateUICommand(UINT32 commandId, UI_COMMANDTYPE typeId, IUICommandHandler** commandHandler)&lt;/b&gt;       &lt;br /&gt;This function is called by the ribbon framework when a command, defined in the ribbon markup, should bind to a command handler. The &lt;b&gt;IUICommandHandler&lt;/b&gt; is yet another interface we should implement to handle commands execution. More on this interface later. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;OnDestroyUICommand(UINT32 commandId, UI_COMMANDTYPE typeId, IUICommandHandler* commandHandler)        &lt;br /&gt;&lt;/b&gt;This function is called by the ribbon framework when the application window gets destroyed, for each command defined in the ribbon markup. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;OnViewChanged(UINT32 viewId, UI_VIEWTYPE typeId, IUnknown* view, UI_VIEWVERB verb, INT32 uReasonCode)        &lt;br /&gt;&lt;/b&gt;This function is called by the ribbon framework when the ribbon view has changed. For example, when the ribbon is resized, created or destroyed. &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;IUICommandHandler Interface&lt;/h4&gt;  &lt;p&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/dd371491(VS.85).aspx"&gt;IUICommandHandler&lt;/a&gt; interface should also be implemented by our application. It is used to execute our code in responds to user actions on the ribbon UI controls. You can think of it as the place to write your &amp;quot;OnButtonClicked&amp;quot; method.&lt;/p&gt;  &lt;p&gt;This interface provides two callbacks that the ribbon framework will invoke when needed.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Execute(UINT32 commandId, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* currentValue, IUISimplePropertySet* commandExecutionProperties)        &lt;br /&gt;&lt;/b&gt;This function is called by the ribbon framework when the user performs an action on a UI control which is bound to the command identified by commandId parameter. An example for such an action is clicking a button or selecting an item in a combobox. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;UpdateProperty(UINT32 commandId, REFPROPERTYKEY key, const PROPVARIANT* currentValue, PROPVARIANT* newValue)        &lt;br /&gt;&lt;/b&gt;This function is called by the ribbon framework when it needs to know the value of a property of a UI control which is bound to the command identified by commandId parameter. This can be used to update properties that changes dynamically, like the items list in a combobox control, or the enabled state of a button. &lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;&lt;/ul&gt;  &lt;h4&gt;Initializing the Ribbon&lt;/h4&gt;  &lt;p&gt;Now that we are familiar with the main players we can better understand the flow of a ribbon enabled application.&lt;/p&gt;  &lt;p&gt;To initialize the ribbon in your application do the following:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;On application load, &lt;em&gt;call&lt;b&gt; CoCreateInstance&lt;/b&gt;&lt;/em&gt; with &lt;b&gt;CLSID_UIRibbonFramework&lt;/b&gt;. The &lt;em&gt;&lt;b&gt;UIRibbonFramework&lt;/b&gt;&lt;/em&gt; class implements &lt;b&gt;IUIFramework &lt;/b&gt;interface. &lt;/li&gt;    &lt;li&gt;Call &lt;b&gt;IUIFramework::Initialize&lt;/b&gt; and pass it a reference to your implementation of the &lt;b&gt;IUIApplication&lt;/b&gt; interface along with the &lt;b&gt;HWND&lt;/b&gt; of your application window. &lt;/li&gt;    &lt;li&gt;Call &lt;b&gt;IUIFramework::LoadUI&lt;/b&gt; which loads the pre-compiled resource and shows the real ribbon. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;The following code shows how to initialize the ribbon framework; it should be called when the application loads. A good place would be when handling the message &lt;b&gt;WM_CREATE&lt;/b&gt;:&lt;/p&gt;  &lt;p&gt;Note: error handling code was removed for clarity.&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:289c964b-fbb2-4074-aa1f-bbdcde1c55c0" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#008000;"&gt;// Here we instantiate the ribbon framework object.&lt;/span&gt;&lt;br /&gt; CoCreateInstance(CLSID_UIRibbonFramework, &lt;br /&gt;                  NULL, &lt;br /&gt;                  CLSCTX_INPROC_SERVER, &lt;br /&gt;                  IID_PPV_ARGS(&amp;amp;g_pFramework));&lt;br /&gt; &lt;br /&gt; &lt;span style="color:#008000;"&gt;// Next, we create the application object (IUIApplication) and call the framework &lt;/span&gt;&lt;br /&gt; &lt;span style="color:#008000;"&gt;// Initialize method, passing the application object and the host HWND &lt;/span&gt;&lt;br /&gt; CApplication::CreateInstance(&amp;amp;g_pApplication);&lt;br /&gt; g_pFramework-&amp;gt;Initialize(hWnd, g_pApplication);&lt;br /&gt; &lt;br /&gt; &lt;span style="color:#008000;"&gt;// Finally, we load the binary markup. This will initiate callbacks to the  &lt;/span&gt;&lt;br /&gt; &lt;span style="color:#008000;"&gt;// IUIApplication object that was provided to the framework earlier, allowing command &lt;/span&gt;&lt;br /&gt; &lt;span style="color:#008000;"&gt;// handlers to be bound to individual commands.&lt;/span&gt;&lt;br /&gt; g_pFramework-&amp;gt;LoadUI(GetModuleHandle(NULL), L&lt;span style="color:#a31515;"&gt;&amp;quot;APPLICATION_RIBBON&amp;quot;&lt;/span&gt;);&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The class &lt;b&gt;CApplication&lt;/b&gt; implements &lt;b&gt;IUIApplication&lt;/b&gt;. The important part of it is to supply implementation of &lt;b&gt;IUICommandHandler&lt;/b&gt; when asked by the ribbon framework.     &lt;br /&gt;This is done by implementing &lt;b&gt;IUIApplication::OnCreateUICommand&lt;/b&gt; as follows:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0c6383e0-7c56-4306-8e6c-9488231532f3" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#008000;"&gt;//  Called by the Ribbon framework for each command specified in markup, to allow&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#008000;"&gt;//  the host application to bind a command handler to that command.&lt;/span&gt;&lt;br /&gt; STDMETHODIMP CApplication::OnCreateUICommand(&lt;br /&gt;     UINT nCmdID,&lt;br /&gt;     UI_COMMANDTYPE typeID,&lt;br /&gt;     IUICommandHandler** ppCommandHandler)&lt;br /&gt; {&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (NULL == m_pCommandHandler)&lt;br /&gt;     {&lt;br /&gt;         CCommandHandler::CreateInstance(&amp;amp;m_pCommandHandler);&lt;br /&gt;     }&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; m_pCommandHandler-&amp;gt;QueryInterface(IID_PPV_ARGS(ppCommandHandler));&lt;br /&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Note that our implementation of &lt;b&gt;IUIApplication&lt;/b&gt; returns the same &lt;b&gt;CCommandHandler&lt;/b&gt; object regardless of the command id. Since the &lt;b&gt;IUICommandHandler::Execute&lt;/b&gt; function receives the executing command id, we can avoid creating a separate command handler class for each command.&lt;/p&gt;  &lt;p&gt;The following diagram (from MSDN) shows the interactions between the different components when initializing a ribbon enabled application:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image004_7C53578D.jpg"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image004" alt="clip_image004" src="http://blogs.microsoft.co.il/blogs/arik/clip_image004_thumb_20983C10.jpg" width="692" height="265" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 3: Initializing a ribbon enabled application&lt;/strong&gt;&lt;/p&gt;  &lt;h5&gt;   &lt;br /&gt;&lt;/h5&gt;  &lt;h4&gt;Implementing Command Handlers&lt;/h4&gt;  &lt;p&gt;In order to respond to the user actions on the ribbon we must implement &lt;b&gt;IUICommandHandler::Execute&lt;/b&gt;:&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:09ac1385-8b53-402d-8ff3-626e69f0390f" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&lt;span style="color:#008000;"&gt;// Called by the Ribbon framework when a command is executed by the user.  &lt;/span&gt;&lt;br /&gt; &lt;span style="color:#008000;"&gt;// For example, when a button is pressed.&lt;/span&gt;&lt;br /&gt; STDMETHODIMP CCommandHandler::Execute(&lt;br /&gt;     UINT nCmdID,&lt;br /&gt;     UI_EXECUTIONVERB verb,&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPERTYKEY* key,&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; PROPVARIANT* ppropvarValue,&lt;br /&gt;     IUISimplePropertySet* pCommandExecutionProperties)&lt;br /&gt; {&lt;br /&gt;     HWND hwnd = GetForegroundWindow();&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;switch&lt;/span&gt; (nCmdID)&lt;br /&gt;     {&lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; ID_CMD_NEW:&lt;br /&gt;         MessageBox(hwnd, L&lt;span style="color:#a31515;"&gt;&amp;quot;New button was clicked&amp;quot;&lt;/span&gt;, L&lt;span style="color:#a31515;"&gt;&amp;quot;New Clicked&amp;quot;&lt;/span&gt;, 0);&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;case&lt;/span&gt; ID_CMD_EXIT:&lt;br /&gt;         PostMessage(hwnd, WM_CLOSE, NULL, NULL);&lt;br /&gt;         &lt;span style="color:#0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt;     }&lt;br /&gt; &lt;br /&gt;     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; S_OK;&lt;br /&gt; }&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;In this example we respond to the &amp;quot;New&amp;quot; button click event and present a message box. We respond to the &amp;quot;Exit&amp;quot; button click event by posting the &lt;b&gt;WM_CLOSE&lt;/b&gt; message.&lt;/p&gt;  &lt;p&gt;You might be asking yourself who declared the &lt;b&gt;ID_CMD_NEW&lt;/b&gt;, &lt;b&gt;ID_CMD_EXIT&lt;/b&gt; constants (and if not, you should!), well, if you recall, in step 2, one of the products of the ribbon markup compiler was a &lt;b&gt;RibbonIDs.h&lt;/b&gt; file. This file contains exactly those constants. The name of the constants is what we have defined in the &lt;b&gt;Symbol&lt;/b&gt; attribute of the command element, in the ribbon markup. The value of the constant is auto-generated, but can be manually specified by using the &lt;b&gt;Id&lt;/b&gt; attribute in the ribbon markup.&lt;/p&gt;  &lt;p&gt;Note that it is critical to use &lt;b&gt;PostMessage&lt;/b&gt; and not &lt;b&gt;SendMessage&lt;/b&gt;, otherwise the application will crash when closing using this exit command.     &lt;br /&gt;This is a classic case of cutting the branch you sit on. The reason for the crash when using &lt;b&gt;SendMessage&lt;/b&gt; is that the handling of &lt;b&gt;WM_CLOSE&lt;/b&gt; invokes &lt;b&gt;IUIFramework::Destroy()&lt;/b&gt; which releases all the COM objects used by the ribbon framework, including &lt;b&gt;CCommandHandler&lt;/b&gt;. Since the &lt;b&gt;CCommandHandler&lt;/b&gt; is still in use (we called &lt;b&gt;SendMessage&lt;/b&gt; from &lt;b&gt;CCommandHandler::Execute&lt;/b&gt;), we get a memory corruption. &lt;/p&gt;  &lt;p&gt;The following diagram (from MSDN) shows the interactions between the different components when the user interacts with the ribbon control:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image005_175C00CF.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image005" alt="clip_image005" src="http://blogs.microsoft.co.il/blogs/arik/clip_image005_thumb_69FA6AFE.png" width="690" height="324" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 4: Ribbon framework interaction with command handler&lt;/strong&gt;&lt;/p&gt;  &lt;h4&gt;&lt;/h4&gt;  &lt;h3&gt;Step 4: Compile Entire Application&lt;/h3&gt;  &lt;p&gt;There is only one addition to the normal compilation process of our Win32 application.    &lt;br /&gt;We need to add a custom build step that runs the ribbon markup compiler and we need to add the generated resource to the application.&lt;/p&gt;  &lt;p&gt;To have your project automatically compile the ribbon markup xml file do the following:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;First, add the &lt;b&gt;RibbonMarkup.xml&lt;/b&gt; file to the project. &lt;/li&gt;    &lt;li&gt;Right click the added file in the &lt;b&gt;Solution Explorer&lt;/b&gt; and select &lt;b&gt;Properties&lt;/b&gt;, &lt;b&gt;Custom Build Step&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;Fill the fields according to the following values: &lt;/li&gt; &lt;/ol&gt;  &lt;ol&gt;&lt;/ol&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;u&gt;Command Line&lt;/u&gt;: &lt;/p&gt;    &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d6ea04a5-0839-4562-aad0-97d6f0d3fd7d" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&amp;quot;%ProgramFiles%&amp;#92;Microsoft SDKs&amp;#92;Windows&amp;#92;v7.0&amp;#92;Bin&amp;#92;UICC.exe&amp;quot; RibbonMarkup.xml $(IntDir)&amp;#92;RibbonUI.bml /header:RibbonIDs.h /res:RibbonResource.rc&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;    &lt;p&gt;Note, on 64 bit operating systems the &amp;quot;%ProgramFiles% environment variable should be replaced with %ProgramW6432%. So the command line should be:&lt;/p&gt;    &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:25434607-b593-4c14-a062-2c63bf775827" class="wlWriterSmartContent"&gt; &lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt; &lt;div style="background-color:#ffffff;overflow:auto;padding:2px 5px;"&gt;&amp;quot;%ProgramW6432%&amp;#92;Microsoft SDKs&amp;#92;Windows&amp;#92;v7.0&amp;#92;Bin&amp;#92;UICC.exe&amp;quot; RibbonMarkup.xml $(IntDir)&amp;#92;RibbonUI.bml /header:RibbonIDs.h /res:RibbonResource.rc&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;    &lt;p&gt;&lt;u&gt;Description&lt;/u&gt;: Compiling Ribbon UI Markup       &lt;br /&gt;&lt;u&gt;       &lt;br /&gt;Outputs&lt;/u&gt;: RibbonUI.bml;RibbonIds.h;RibbonResource.rc&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now that we&amp;#39;ve done these steps we need to compile the application at least once so that the &lt;b&gt;RibbonResource.rc&lt;/b&gt; file gets generated.&lt;/p&gt;  &lt;p&gt;Now we add &lt;b&gt;RibbonResource.rc&lt;/b&gt; to the project. This will cause the compiled binary representation of the ribbon UI to be embedded as a resource in the application executable.&lt;/p&gt;  &lt;p&gt;Finally, don&amp;#39;t forget to add the images you used in to the ribbon markup to project folder. Make sure you use the same relative location as specified in the markup file.&lt;/p&gt;  &lt;p&gt;Now sit back and enjoy your first ribbon enabled application.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image006_729AC38A.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="clip_image006" alt="clip_image006" src="http://blogs.microsoft.co.il/blogs/arik/clip_image006_thumb_5715C187.png" width="627" height="202" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;strong&gt;Figure 5: First ribbon enabled application&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In this post we have seen in details the necessary steps to create an application that uses the Windows Ribbon Framework. &lt;/p&gt;  &lt;p&gt;A working demo of the code presented in this post can be found &lt;a href="http://blogs.microsoft.co.il/blogs/arik/RibbonPost2Demo.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;That&amp;#39;s it for now,    &lt;br /&gt;Arik Poznanski.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/06/ribbon-with-c-part-2-first-ribbon-enabled-application.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/06/ribbon-with-c-part-2-first-ribbon-enabled-application.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/06/ribbon-with-c-part-2-first-ribbon-enabled-application.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/06/ribbon-with-c-part-2-first-ribbon-enabled-application.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=172641" rel="tag" style="display:none;"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=841156" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/COM/default.aspx">COM</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2B002B00_/default.aspx">C++</category></item><item><title>Ribbon with C++, Part 1: Introduction to the Windows Ribbon Framework</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/03/ribbon-with-c-part-1-introduction-to-the-windows-ribbon-framework.aspx</link><pubDate>Fri, 03 Jun 2011 07:00:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:839700</guid><dc:creator>arik</dc:creator><slash:comments>8</slash:comments><description>&lt;p&gt;Due to popular demand I’ve decided to use the knowledge I’ve gain while creating the &lt;a href="http://windowsribbon.codeplex.com/"&gt;Windows Ribbon for WinForms&lt;/a&gt; project and write a series of posts about working with the &lt;strong&gt;Windows Ribbon Framework&lt;/strong&gt; with &lt;strong&gt;Win32 C++&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;In this post we will learn the basics of the Windows Ribbon Framework.&lt;/p&gt;
&lt;h3&gt;What Is a Ribbon?&lt;/h3&gt;
&lt;p&gt;&lt;u&gt;Definition (from &lt;/u&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd371191(VS.85).aspx"&gt;MSDN&lt;/a&gt;&lt;u&gt;):&lt;/u&gt; &lt;i&gt;“The Windows Ribbon framework is a rich command presentation system that provides a modern alternative to the layered menus, toolbars, and task panes of traditional Windows applications.&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;Put another way, it is the upper part of most office 2007 applications:&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image002_68160475.jpg"&gt;&lt;img style="MARGIN:0px auto;DISPLAY:block;FLOAT:none;" title="clip_image002" alt="clip_image002" src="http://blogs.microsoft.co.il/blogs/arik/clip_image002_thumb_283BF823.jpg" width="692" height="106" /&gt;&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;strong&gt;Figure 1: Microsoft Word 2007 Ribbon&lt;/strong&gt;&lt;/p&gt;The ribbon is an innovative way to expose functionality to the user. You can see from the image that the ribbon is composed from tabs, where each tab has groups with buttons, check-boxes, combo-boxes, image galleries, etc. &lt;br /&gt;It may look like just another toolbar layout, but it’s so much more than that. 
&lt;p&gt;First, the ribbon exposes all the application functions. No more endless menu items hiding your needed feature in a deep sub-menu you can never find. &lt;/p&gt;
&lt;p&gt;Second, the UI is consistent. The ribbon is the only place to look for &lt;/p&gt;
&lt;p&gt;a feature. You no longer need to search through menus, toolbars and dialogs.&lt;/p&gt;
&lt;p&gt;If you have Windows 7 installed and you want to see a live example of the Windows Ribbon Framework check out both &lt;strong&gt;Paint&lt;/strong&gt; and &lt;strong&gt;WordPad&lt;/strong&gt; applications. &lt;br /&gt;Another application that uses this ribbon is Microsoft Movie Maker, which is part of &lt;a href="http://download.live.com/"&gt;Windows Live Essentials&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image004_4CED0F9A.jpg"&gt;&lt;img style="MARGIN:0px auto;DISPLAY:block;FLOAT:none;" title="clip_image004" alt="clip_image004" src="http://blogs.microsoft.co.il/blogs/arik/clip_image004_thumb_51EF4D49.jpg" width="692" height="99" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;strong&gt;Figure 2: Microsoft Paint in Windows 7&lt;/strong&gt;&lt;/p&gt;
&lt;p align="center"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="center"&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Why Was It Developed In The First Place?&lt;/h3&gt;
&lt;p&gt;Back in August 2003, when Office 2003 came out, the general consensus was that office was done, in a sense that all the required features were finished. On a closer inspection people have admitted that office is very powerful but they don&amp;#39;t know how to take advantage of it. The conclusion the office team reached was that the user interface was failing their users.&lt;/p&gt;
&lt;p&gt;To better understand why the UI was failing the users, consider this:&lt;/p&gt;
&lt;p&gt;Word 1.0, released back in 1989, had 2 toolbar and less than 50 menu items. That much UI is easily mastered by any user.&lt;/p&gt;
&lt;p&gt;By the time Word 2003 came out it had 31 toolbars (each consists of many buttons), 19 task panes (just another place to look for commands) and over 250 distinct menu items.&lt;/p&gt;
&lt;p&gt;With so much UI functionality, people didn&amp;#39;t even know where to look for a feature.&lt;/p&gt;
&lt;p&gt;In fact, one obvious way to deduce there was a problem with the office UI was that people kept asking for features that already existed!&lt;/p&gt;
&lt;p&gt;So, to rectify the situation Microsoft did an extensive study on what bothered office users the most. In addition they have collected over 3,000,000,000 (yep, that’s 3 billion) office sessions to research how users actually use office.&lt;/p&gt;
&lt;p&gt;After getting all this information they began redesigning the Office UI to better answer the user&amp;#39;s needs. And so, after making usability tests on many innovative user interfaces, they came up with the ribbon.&lt;/p&gt;
&lt;p&gt;The ribbon is the single place where the user should look for functionality. The goal was to keep the user&amp;#39;s focus on their content, cut the number of choices presented at any given time and above all, be consistent.&lt;/p&gt;
&lt;h3&gt;Ribbon APIs And Their Intended Audience&lt;/h3&gt;
&lt;p&gt;Since the office ribbon turned out to be a major success, it was not long before many users started to request the ribbon feature in other third-party applications. &lt;br /&gt;In order to meet public demands Microsoft provided several implementations of the ribbon, each consistent with a different programming model and intended for different audience.&lt;/p&gt;
&lt;p&gt;Note that the ribbon user experience remains the same regardless of the implementation.&lt;/p&gt;
&lt;p&gt;Following are the Ribbon APIs available to date:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd316910(v=VS.85).aspx"&gt;Windows Ribbon Framework&lt;/a&gt;, the subject of this post, available in Windows 7 and Windows Vista with platform update, exposes a COM-based API, to be used by native Win32 developers. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/vcblog/archive/2007/11/09/quick-tour-of-new-mfc-functionality.aspx"&gt;MFC Ribbon&lt;/a&gt;, available in Visual C++ 2008 Feature Pack, intended to be used by native MFC developers. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeplex.com/wpf/Wiki/View.aspx?title=WPF%20Ribbon%20Preview"&gt;WPF Ribbon, Preview Version&lt;/a&gt;, available in WPF toolkit for .Net 3.5 SP1, to be used by managed WPF developers. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa942866(VS.80).aspx"&gt;Visual Studio Tools for Office Ribbon&lt;/a&gt;, available with VSTO, to be used by office add-ins developers. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/vsixforsp"&gt;SharePoint Ribbon&lt;/a&gt;, available in SharePoint 2010, to be used by SharePoint developers. &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;u&gt;Note&lt;/u&gt;: WinForms developers can use &lt;a href="http://windowsribbon.codeplex.com/"&gt;Windows Ribbon for WinForms&lt;/a&gt;, which is a COM-Interop based wrapper around Windows Ribbon Framework.&lt;/p&gt;
&lt;h3&gt;Windows Ribbon Framework Overview&lt;/h3&gt;
&lt;p&gt;Let&amp;#39;s review what are the included features in the Windows Ribbon Framework. &lt;br /&gt;We will elaborate on some of these features in future posts.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Promotes separation of the view (UI controls) and commands (actions that the UI controls trigger). &lt;/li&gt;
&lt;li&gt;Provides a full set of UI controls to represent our commands: 
&lt;ul&gt;
&lt;li&gt;Different kinds of buttons: &lt;b&gt;Button&lt;/b&gt;, &lt;b&gt;HelpButton&lt;/b&gt;, &lt;b&gt;SplitButton&lt;/b&gt; and &lt;strong&gt;DropButton&lt;/strong&gt;.&lt;strong&gt; &lt;/strong&gt;&lt;br /&gt;The first two are used to represent a single command, whereas the last two each represent a collection of commands. &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image006_1412B5CD.png"&gt;&lt;img style="MARGIN:0px auto;DISPLAY:block;FLOAT:none;" title="clip_image006" alt="clip_image006" src="http://blogs.microsoft.co.il/blogs/arik/clip_image006_thumb_6B472AB6.png" width="340" height="248" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;strong&gt;Figure 3: Three buttons&lt;/strong&gt;&lt;/p&gt;
&lt;p align="center"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="center"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="center"&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;CheckBox&lt;/b&gt; and &lt;b&gt;ToggleButton&lt;/b&gt; are two UI representations of a single command with a Boolean state. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;Spinner&lt;/b&gt; is a UI representation of a numerical value along with up / down buttons that allows the user to change it. 
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image008_1EDF7148.png"&gt;&lt;img style="MARGIN:0px auto;DISPLAY:block;FLOAT:none;" title="clip_image008" alt="clip_image008" src="http://blogs.microsoft.co.il/blogs/arik/clip_image008_thumb_3B98E65D.png" width="270" height="243" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;strong&gt;Figure 4: Spinner Control&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;ComboBox&lt;/b&gt; represents a list of &lt;b&gt;text&lt;/b&gt; items that one of them can be selected. &lt;/li&gt;
&lt;li&gt;A gallery represents a dynamically populated list of &lt;b&gt;image&lt;/b&gt; items that one of them can be selected. &lt;br /&gt;Galleries also give the live preview feature which enable users to see the results of selecting an item before actually selecting it. &lt;br /&gt;Galleries come in three variants: &lt;b&gt;DropDownGallery&lt;/b&gt;, &lt;b&gt;SplitButtonGallery&lt;/b&gt; and &lt;b&gt;InRibbonGallery&lt;/b&gt;. 
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image010_71BA5EAC.png"&gt;&lt;img style="MARGIN:0px auto;DISPLAY:block;FLOAT:none;" title="clip_image010" alt="clip_image010" src="http://blogs.microsoft.co.il/blogs/arik/clip_image010_thumb_2E22AD8A.png" width="350" height="236" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;strong&gt;Figure 5: InRibbonGallery used in Microsoft Paint&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;FontControl&lt;/b&gt; is a composite UI control that encapsulates the needed UI to control font properties like font family, font size, bold, etc. &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image012_636BBFEF.png"&gt;&lt;img style="MARGIN:0px auto;DISPLAY:block;FLOAT:none;" title="clip_image012" alt="clip_image012" src="http://blogs.microsoft.co.il/blogs/arik/clip_image012_thumb_2EEAEDA7.png" width="396" height="174" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;strong&gt;Figure 6: Font Control&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;DropDownColorPicker&lt;/b&gt; is a split button that drops down to a full-sized color picker control. 
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image014_25427F71.jpg"&gt;&lt;img style="MARGIN:0px auto;DISPLAY:block;FLOAT:none;" title="clip_image014" alt="clip_image014" src="http://blogs.microsoft.co.il/blogs/arik/clip_image014_thumb_30F7C6A3.jpg" width="217" height="284" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;strong&gt;Figure 7: Drop Down Color Picker&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;The UI controls can be layout in tabs and groups or application menu. &lt;br /&gt;The group layout changes automatically according to the available space on screen and the layout definition. &lt;br /&gt;The group layout definition can be chosen from a predefined list of layouts or can be customized according to the user needs. &lt;/li&gt;
&lt;li&gt;Support for changing the ribbon structure according to current application mode. &lt;/li&gt;
&lt;li&gt;Contextual tabs allows you to add temporary tabs when a certain context is available (like showing image tools only when an image is selected). &lt;/li&gt;
&lt;li&gt;Provides Quick Access Toolbar (&lt;b&gt;QAT&lt;/b&gt;), a place for commands that the user selected for quick access. &lt;/li&gt;
&lt;li&gt;Allows controlling the ribbon colors and visibility properties. &lt;/li&gt;
&lt;li&gt;Provides an enhanced context popup to go with the ribbon. 
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image016_5A1F5EE1.png"&gt;&lt;img style="MARGIN:0px auto;DISPLAY:block;FLOAT:none;" title="clip_image016" alt="clip_image016" src="http://blogs.microsoft.co.il/blogs/arik/clip_image016_thumb_5F7DA9B8.png" width="606" height="536" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;strong&gt;Figure 8: Ribbon Context Popup&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;Provides highly accessible UI by implementing Microsoft Active Accessibility. &lt;/li&gt;
&lt;li&gt;Provides support for High DPI and High Contrast settings. &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Windows Ribbon Framework Requirements&lt;/h3&gt;
&lt;p&gt;Although Windows Ribbon Framework came out with Windows 7, it was made available to Windows Vista using the platform update mechanism.&lt;/p&gt;
&lt;p&gt;The full list of Windows Ribbon Framework supported platforms is as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Windows 7 &lt;/li&gt;
&lt;li&gt;Windows Vista with Service Pack 2 (SP2) and Platform Update for Windows Vista &lt;/li&gt;
&lt;li&gt;Windows Server 2008 R2 &lt;/li&gt;
&lt;li&gt;Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Note that Windows XP is not supported.&lt;/p&gt;
&lt;p&gt;In addition, to develop ribbon enabled applications you must install the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&amp;amp;displaylang=en"&gt;Windows 7 SDK&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Using the Windows Ribbon Framework&lt;/h3&gt;
&lt;p&gt;Writing a ribbon-enabled application is a four steps process:&lt;/p&gt;
&lt;h4&gt;Step 1: Define the Ribbon UI&lt;/h4&gt;
&lt;p&gt;The Ribbon UI is defined in an XML file, using XAML-based syntax. &lt;br /&gt;In the file you declare what controls to use and how to layout them the ribbon surface.&lt;/p&gt;
&lt;h4&gt;Step 2: Compile Ribbon UI&lt;/h4&gt;
&lt;p&gt;Using a special compiler, named UICC.exe, you compile the ribbon UI definition into a binary resource file.&lt;/p&gt;
&lt;h4&gt;Step 3: Write handler code&lt;/h4&gt;
&lt;p&gt;In this step you write the code that runs in responds to user action on the UI, e.g. pressing a button. &lt;/p&gt;
&lt;h4&gt;Step 4: Compile entire application&lt;/h4&gt;
&lt;p&gt;In this last step you need to compile the code from step 3 and link with the binary resource output from step 2.&lt;/p&gt;
&lt;p&gt;The following diagram (taken from MSDN) illustrates these steps:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/clip_image017_36826EE2.png"&gt;&lt;img style="MARGIN:0px auto;DISPLAY:block;FLOAT:none;" title="clip_image017" alt="clip_image017" src="http://blogs.microsoft.co.il/blogs/arik/clip_image017_thumb_3FAE8456.png" width="720" height="450" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In this post we have seen what is the ribbon, why was it developed and what ribbon API exist. We also reviewed the features provided by Windows Ribbon Framework and the basic steps for writing a ribbon enabled application. &lt;br /&gt;On future posts we will dive into the details of creating ribbon enabled applications and see how to use its different features.&lt;/p&gt;
&lt;p&gt;That&amp;#39;s it for now, &lt;br /&gt;Arik Poznanski.&lt;/p&gt;
&lt;div style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px;" class="wlWriterHeaderFooter"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/03/ribbon-with-c-part-1-introduction-to-the-windows-ribbon-framework.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/03/ribbon-with-c-part-1-introduction-to-the-windows-ribbon-framework.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/03/ribbon-with-c-part-1-introduction-to-the-windows-ribbon-framework.aspx"&gt;&lt;img style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;BORDER-TOP:0px;BORDER-RIGHT:0px;" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/06/03/ribbon-with-c-part-1-introduction-to-the-windows-ribbon-framework.aspx" /&gt;&lt;/a&gt; &lt;a style="DISPLAY:none;" href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=172641" rel="tag"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=839700" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Controls/default.aspx">Controls</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2B002B00_/default.aspx">C++</category></item><item><title>Sela Haifa Open House: Windows 7 features and Multi-Touch Session – Slide Deck and Demos</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/24/sela-haifa-open-house-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx</link><pubDate>Wed, 25 May 2011 02:27:13 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:837373</guid><dc:creator>arik</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;Today (24.05.2011) I’ve delivered two sessions about “&lt;strong&gt;Using Windows 7 Features in .NET applications&lt;/strong&gt;” in Sela Haifa Open House which was presented in Philips building in Haifa.&lt;/p&gt;  &lt;p&gt;Dear Philips (and other) developers, I had a great time presenting today&amp;#39;s Windows 7 sessions. Thank you for coming!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" alt="" src="http://blogs.microsoft.co.il/blogs/arik/image_5EF24134.png" /&gt;&lt;/p&gt;  &lt;p&gt;In the sessions I talked about how to use new Windows 7 features like the new Taskbar, sensors API, the Ribbon control supplied with Windows 7, Application restart and Recovery and plenty of Multi-Touch.    &lt;br /&gt;We’ve seen numerous examples, mainly in C++ Win32, WinForms and WPF.&lt;/p&gt;  &lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" alt="" src="http://blogs.microsoft.co.il/blogs/arik/image_775D7EEB.png" width="640" height="121" /&gt;&lt;/p&gt;  &lt;p&gt;You can download both the presentations and the demos &lt;a href="http://cid-552e8ea12a93deba.office.live.com/browse.aspx/.Public/Win7%20Sela%20Haifa%20Open%20House?uc=3"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;That’s it for now,    &lt;br /&gt;Arik Poznanski.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/24/sela-haifa-open-house-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/24/sela-haifa-open-house-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/24/sela-haifa-open-house-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/24/sela-haifa-open-house-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=837373" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WinForms/default.aspx">WinForms</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Sela/default.aspx">Sela</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Touch/default.aspx">Touch</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Sela+Open+House/default.aspx">Sela Open House</category></item><item><title>.NET User Group: Windows 7 features and Multi-Touch Session – Slide Deck and Demos</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/20/net-user-group-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx</link><pubDate>Fri, 20 May 2011 06:22:46 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:836550</guid><dc:creator>arik</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" src="http://blogs.microsoft.co.il/blogs/arik/image_5EF24134.png" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;Yesterday (18.05.2011) I’ve delivered two sessions about “&lt;strong&gt;Using Windows 7 Features in .NET applications&lt;/strong&gt;” in the Israeli .NET User Group, at Microsoft offices in Ra’anana.&lt;/p&gt;  &lt;p&gt;I want to thank all the attendees who came to hear the sessions, I truly enjoyed it.&lt;/p&gt;  &lt;p&gt;In the sessions I talked about how to use new Windows 7 features like the new Taskbar, sensors API, the Ribbon control supplied with Windows 7, Application restart and Recovery and plenty of Multi-Touch.    &lt;br /&gt;We’ve seen numerous examples in C++ Win32, C# WinForms, C# WPF and C# Silverlight.&lt;/p&gt;  &lt;p&gt;&lt;img src="http://blogs.microsoft.co.il/blogs/arik/image_775D7EEB.png" width="640" height="121" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;Since we were a little short on time, I couldn’t answer everyone&amp;#39;s questions. So if you got an unanswered question, feel free to contact me by mail (find it on my blog left panel) or using the blog contact form.&lt;/p&gt;  &lt;p&gt;You can download both the presentations and the demos &lt;a href="http://cid-552e8ea12a93deba.office.live.com/browse.aspx/.Public/Win7%20.NET%20User%20Group?uc=3"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;That’s it for now,    &lt;br /&gt;Arik Poznanski.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/20/net-user-group-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/20/net-user-group-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/20/net-user-group-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/20/net-user-group-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;a href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=172641" rel="tag" style="display:none;"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=836550" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WinForms/default.aspx">WinForms</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Sela/default.aspx">Sela</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Touch/default.aspx">Touch</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/.NET+User+Group/default.aspx">.NET User Group</category></item><item><title>Coming session: Using Windows 7 Features in .NET Applications, at Sela Haifa in Israel</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/14/coming-session-using-windows-7-features-in-net-applications-at-sela-haifa-in-israel.aspx</link><pubDate>Sat, 14 May 2011 23:51:06 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:835215</guid><dc:creator>arik</dc:creator><slash:comments>1</slash:comments><description>&lt;div class="wlWriterHeaderFooter" style="float:none;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;iframe src="http://www.facebook.com/widgets/like.php?href=http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/14/coming-session-using-windows-7-features-in-net-applications-at-sela-haifa-in-israel.aspx" scrolling="no" frameborder="0" style="border:none;width:130px;height:80px;"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;p&gt;In case you missed one of my previous Windows 7 sessions, here is your chance to catch it.&lt;/p&gt;  &lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" src="http://blogs.microsoft.co.il/blogs/arik/sela_logo.png" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;On May 24th I’ll be giving two sessions about “&lt;strong&gt;Using Windows 7 Features in .NET Applications&lt;/strong&gt;”, as part of &lt;strong&gt;Sela Haifa Open House&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;On the first session “&lt;strong&gt;The 7 Show: From XP to Win 7&lt;/strong&gt;” we will talk about new features in Windows 7 that will modernize your application.     &lt;br /&gt;We will learn how to work with the new Taskbar, how to work with Sensors, how to use the Ribbon interface and more.     &lt;br /&gt;The session will be rich with examples in .NET, WPF and WinForms.&lt;/p&gt;  &lt;p&gt;On the second session “&lt;strong&gt;Touch Everywhere&lt;/strong&gt;” we will see how to use the Multi-touch feature which comes out of the box in Windows 7.     &lt;br /&gt;We will learn about the possible level of support (Good, Better &amp;amp; Best) and learn about helper libraries that provide a convenient API when working with multi-touch devices.     &lt;br /&gt;The session will include many examples in all the common UI technologies: C++, WinForms, WPF and Silverlight.&lt;/p&gt;  &lt;p&gt;The entrance is free, but requires &lt;a href="https://webcast.you-niversity.com/youtools/companies/registration/registerForm.asp?affiliateId=145&amp;amp;programId=789&amp;amp;tzOffset=-3&amp;amp;tzOffsetRgn=EEST"&gt;registration&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Hope to see you there!&lt;/p&gt;  &lt;p&gt;That’s it for now,    &lt;br /&gt;Arik Poznanski.&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=835215" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WinForms/default.aspx">WinForms</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Sela/default.aspx">Sela</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Touch/default.aspx">Touch</category></item><item><title>Coming session: Using Windows 7 Features in .NET Applications, at .NET User Group in Israel</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/07/coming-session-using-windows-7-features-in-net-applications-at-net-user-group-in-israel.aspx</link><pubDate>Sun, 08 May 2011 03:54:27 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:833678</guid><dc:creator>arik</dc:creator><slash:comments>1</slash:comments><description>&lt;div class="wlWriterHeaderFooter" style="float:none;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;iframe src="http://www.facebook.com/widgets/like.php?href=http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/07/coming-session-using-windows-7-features-in-net-applications-at-net-user-group-in-israel.aspx" scrolling="no" frameborder="0" style="border:none;width:130px;height:80px;"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;p&gt;&lt;img alt="" src="http://image.test.exacttarget.com/lib/fef71779766603/m/1/WWE_Email_Header.png" /&gt;&lt;/p&gt;  &lt;p&gt;On May 18th I’ll be giving two sessions about “&lt;strong&gt;Using Windows 7 Features in .NET Applications&lt;/strong&gt;”, as part of the monthly .NET User Group sessions, in Microsoft offices, Ra’anana, Israel.&lt;/p&gt;  &lt;p&gt;On the first session “&lt;strong&gt;The 7 Show: From XP to Win 7&lt;/strong&gt;” we will talk about new features in Windows 7 that will modernize your application.     &lt;br /&gt;We will learn how to work with the new Taskbar, how to work with Sensors, how to use the Ribbon interface and more.     &lt;br /&gt;The session will be rich with examples in .NET, WPF and WinForms.&lt;/p&gt;  &lt;p&gt;On the second session “&lt;strong&gt;Touch Everywhere&lt;/strong&gt;” we will see how to use the Multi-touch feature which comes out of the box in Windows 7.     &lt;br /&gt;We will learn about the possible level of support (Good, Better &amp;amp; Best) and learn about helper libraries that provide a convenient API when working with multi-touch devices.     &lt;br /&gt;The session will include many examples in all the common UI technologies: C++, WinForms, WPF and Silverlight.&lt;/p&gt;  &lt;p&gt;The entrance is free, but requires &lt;a href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032486579&amp;amp;Culture=he-IL"&gt;registration&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Hope to see you there!&lt;/p&gt;  &lt;p&gt;That’s it for now,    &lt;br /&gt;Arik Poznanski.&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=833678" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WinForms/default.aspx">WinForms</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Touch/default.aspx">Touch</category></item><item><title>MSDN Event: Windows 7 features and Multi-Touch Session - Slide Deck and Demos</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/04/09/msdn-event-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx</link><pubDate>Sat, 09 Apr 2011 21:41:19 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:817285</guid><dc:creator>arik</dc:creator><slash:comments>3</slash:comments><description>&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_5EF24134.png"&gt;&lt;img style="margin:0px auto;display:block;float:none;" title="image" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_1CDAEA7F.png" width="480" height="360" /&gt;&lt;/a&gt;   &lt;p&gt;Last Thursday (07.04.2011) I’ve delivered an MSDN session about&amp;#160; “&lt;strong&gt;Using Windows 7 Features in .NET applications&lt;/strong&gt;” at Microsoft Ra’anana.&lt;/p&gt;  &lt;p&gt;I want to thank all the attendees who came to hear the session, I truly enjoyed it.&lt;/p&gt;  &lt;p&gt;In the session I talked about how to use new Windows 7 features like the new Taskbar, sensors API, the Ribbon control supplied with Windows 7, Application restart and Recovery and plenty of Multi-Touch.    &lt;br /&gt;We’ve seen numerous examples in C++ Win32, C# WinForms, C# WPF and C# Silverlight.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/image_775D7EEB.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/arik/image_thumb_6ABFAC02.png" width="864" height="164" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You can download both the presentations and the demos &lt;a href="http://cid-552e8ea12a93deba.office.live.com/browse.aspx/.Public/Win7%20MSDN%20Event?uc=3"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;That’s it for now,    &lt;br /&gt;Arik Poznanski.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/04/09/msdn-event-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/04/09/msdn-event-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/04/09/msdn-event-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/arik/archive/2011/04/09/msdn-event-windows-7-features-and-multi-touch-session-slide-deck-and-demos.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=817285" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WinForms/default.aspx">WinForms</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Sela/default.aspx">Sela</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Touch/default.aspx">Touch</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/MSDN/default.aspx">MSDN</category></item><item><title>Coming session: Using Windows 7 Features in .NET Applications, in Microsoft Israel</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/03/28/coming-session-using-windows-7-features-in-net-applications-in-microsoft-israel.aspx</link><pubDate>Tue, 29 Mar 2011 03:33:43 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:814841</guid><dc:creator>arik</dc:creator><slash:comments>1</slash:comments><description>&lt;div class="wlWriterHeaderFooter" style="float:none;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;iframe src="http://www.facebook.com/widgets/like.php?href=http://blogs.microsoft.co.il/blogs/arik/archive/2011/03/28/coming-session-using-windows-7-features-in-net-applications-in-microsoft-israel.aspx" scrolling="no" frameborder="0" style="border:none;width:130px;height:80px;"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;p&gt;&lt;img src="http://image.test.exacttarget.com/lib/fef71779766603/m/1/WWE_Email_Header.png" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;Next Thursday, 07.04.2011, I’ll be giving two sessions about “&lt;strong&gt;Using Windows 7 Features in .NET Applications&lt;/strong&gt;”, in Microsoft offices, Ra’anana, Israel.&lt;/p&gt;  &lt;p&gt;On the first session “&lt;strong&gt;The 7 Show: From XP to Win 7&lt;/strong&gt;” we will talk about new features in Windows 7 that will modernize your application.     &lt;br /&gt;We will learn how to work with the new Taskbar, how to work with Sensors, how to use the Ribbon interface and more.     &lt;br /&gt;The session will be rich with examples in .NET, WPF and WinForms.&lt;/p&gt;  &lt;p&gt;On the second session “&lt;strong&gt;Touch Everywhere&lt;/strong&gt;” we will see how to use the Multi-touch feature which comes out of the box in Windows 7.     &lt;br /&gt;We will learn about the possible level of support (Good, Better &amp;amp; Best) and learn about helper libraries that provide a convenient API when working with multi-touch devices.     &lt;br /&gt;The session will include many examples in all the common UI technologies: C++, WinForms, WPF and Silverlight.&lt;/p&gt;  &lt;p&gt;The entrance is free, but requires &lt;a href="https://msevents.microsoft.com/cui/EventDetail.aspx?EventID=1032480994&amp;amp;culture=he-IL"&gt;registration&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Hope to see you there!&lt;/p&gt;  &lt;p&gt;That’s it for now,    &lt;br /&gt;Arik Poznanski&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=814841" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WinForms/default.aspx">WinForms</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Sela/default.aspx">Sela</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Touch/default.aspx">Touch</category></item><item><title>3-Screens Development using WPF, SL and WP7 - SDP 2011 Conference</title><link>http://blogs.microsoft.co.il/blogs/arik/archive/2011/03/16/3-screens-development-using-wpf-sl-and-wp7-sdp-2011-conference.aspx</link><pubDate>Wed, 16 Mar 2011 17:59:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:806885</guid><dc:creator>arik</dc:creator><slash:comments>3</slash:comments><description>&lt;div style="PADDING-BOTTOM:4px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FLOAT:none;PADDING-TOP:4px;" class="wlWriterHeaderFooter"&gt;&lt;iframe style="BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;WIDTH:130px;HEIGHT:80px;BORDER-TOP:medium none;BORDER-RIGHT:medium none;" src="http://www.facebook.com/widgets/like.php?href=http://blogs.microsoft.co.il/blogs/arik/archive/2011/03/16/3-screens-development-using-wpf-sl-and-wp7-sdp-2011-conference.aspx" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;p&gt;Yesterday I’ve delivered my lecture titled “&lt;strong&gt;3-Screens Development using WPF, SL and WP7&lt;/strong&gt;” in the SDP 2011 conference.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/arik/197389_201361109891595_184255348268838_680237_2957281_n_2EDA2E11.jpg"&gt;&lt;img style="MARGIN:0px auto;DISPLAY:block;FLOAT:none;" title="197389_201361109891595_184255348268838_680237_2957281_n" alt="197389_201361109891595_184255348268838_680237_2957281_n" src="http://blogs.microsoft.co.il/blogs/arik/197389_201361109891595_184255348268838_680237_2957281_n_thumb_4F5147F6.jpg" width="720" height="540" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In this lecture I’ve presented the application &lt;a href="http://code.msdn.microsoft.com/FlashCards"&gt;FlashCards.Show&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;which has 3 clients in WPF, Silverlight and Windows Phone 7.&lt;/p&gt;
&lt;p&gt;I showed how to share the code base between the different clients using: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;MVVM &lt;/li&gt;
&lt;li&gt;Adding files as links &lt;/li&gt;
&lt;li&gt;Preprocessor symbols &lt;/li&gt;
&lt;li&gt;OOP &lt;/li&gt;
&lt;li&gt;Portable Library tools &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Then I showed a few features that exist in WPF and don’t exist in Silverlight, and how one can overcome this gap.&lt;/p&gt;
&lt;p&gt;Specifically I showed how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Implement &lt;strong&gt;Commands&lt;/strong&gt; in Silverlight 3 &lt;/li&gt;
&lt;li&gt;Implement &lt;strong&gt;ClipToBounds&lt;/strong&gt; property &lt;/li&gt;
&lt;li&gt;Implement a &lt;strong&gt;DataTemplateSelector&lt;/strong&gt; replacement &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;I want to thank all the people who came to my lecture today. &lt;br /&gt;I really enjoyed it and I hope you too.&lt;/p&gt;
&lt;p&gt;You can download the PowerPoint presentation and the demos &lt;a href="http://cid-552e8ea12a93deba.office.live.com/browse.aspx/.Public?uc=1"&gt;here&lt;/a&gt;&lt;strong&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In addition you can find more references on porting from WPF to Silverlight in the following posts:&lt;/p&gt;
&lt;p&gt;&lt;a title="Porting from WPF to Silverlight- The Missing Pieces, Part 1" href="http://blogs.microsoft.co.il/blogs/arik/archive/2010/09/21/porting-from-wpf-to-silverlight-the-missing-pieces-part-1.aspx"&gt;Porting from WPF to Silverlight- The Missing Pieces, Part 1&lt;/a&gt; &lt;br /&gt;&lt;a title="Porting from WPF to Silverlight- The Missing Pieces, Part 2" href="http://blogs.microsoft.co.il/blogs/arik/archive/2010/09/23/porting-from-wpf-to-silverlight-the-missing-pieces-part-2.aspx"&gt;Porting from WPF to Silverlight- The Missing Pieces, Part 2&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I will post again when my lecture will be available to view on &lt;a href="http://scc.sela.co.il/scc"&gt;Sela College Channel&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;That’s it for now, &lt;br /&gt;Arik Poznanski.&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=806885" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Sela/default.aspx">Sela</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/SDP/default.aspx">SDP</category><category domain="http://blogs.microsoft.co.il/blogs/arik/archive/tags/SDP+2011/default.aspx">SDP 2011</category></item></channel></rss>