It's a good idea to at least view Microsoft's
PreviewRibbon example before you perform much development work of your
own, because managed code examples for the Ribbon are a bit scarce. In
addition, getting Microsoft's example to work will also prepare your
machine for your own development efforts and help you understand
potential distribution problems for production applications. The
following steps help you get the example to work properly:
Open
the example using Visual Studio 2010. You'll immediately notice that
you need to convert it for use with Visual Studio 2010. The conversion
should proceed without error. Try to compile the code to locate four errors within the application. The errors appear in the ConfigOptions.CS file. Change each of the val = ConfigurationSettings.AppSettings["StringValue"]; lines to read val = ConfigurationManager.AppSettings["StringValue"];.
The code will compile at this point, but you still won't see the
example work. That's because you haven't specified a Ribbon definition
file for the example to use. Copy the BasicRibbon.XML into the Debug folder for the application, so the application can easily access it. Right-click the PreviewRibbon entry in Solution Explorer and choose Properties from the context menu. Select the Debug tab and type BasicRibbon.XML in the Command Line Arguments field.
You should be ready to go now. Assuming you have the Windows 7 SDK installed, the example should run. Choose Start All Programs Microsoft Windows SDK v7.1
Windows SDK 7.1 Command Prompt. Windows will open a command prompt.
Change directories to the Debug folder of the PreviewRibbon application
(normally \PreviewRibbon-src\source\bin). Type PreviewRibbon BasicRibbon.XML and press Enter.
Of course, you might want to run the example from within Visual Studio. In this case, open the App.CONFIG file. You'll see four entries in the <appSettings>
tag. Uncomment these entries and ensure that the paths point to the
locations of the utilities that the application requires. Here are the
entries for Visual Studio 2010 using the Windows 7 SDK version 7.1 on a
64-bit system :
<add key="UiccPath" value="C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\UICC.exe" />
<add key="RCExePath" value="C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\RC.exe" /> <add key="LinkExePath" value="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\Link.exe" /> <add key="ColorizationValues" value="150, 127, 245; 25, 127, 245; 150, 71, 158" />
As an alternative to changing the App.CONFIG file, you can also change the paths provided by the sdkBinPath, vsBinPath32, and vsBinPath64 variables found in ToolHost.CS. Changing either file will work.
|