<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tayyab Bin Tariq &#187; Microsoft Technologies</title>
	<atom:link href="http://tayyab.xenoglaux-solutions.com/category/microsoft-technologies/feed/" rel="self" type="application/rss+xml" />
	<link>http://tayyab.xenoglaux-solutions.com</link>
	<description>I like sharing what i know</description>
	<lastBuildDate>Fri, 21 May 2010 20:59:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to block specific ports in Windows 7</title>
		<link>http://tayyab.xenoglaux-solutions.com/2010/05/09/how-to-block-specific-ports-in-windows-7/</link>
		<comments>http://tayyab.xenoglaux-solutions.com/2010/05/09/how-to-block-specific-ports-in-windows-7/#comments</comments>
		<pubDate>Sun, 09 May 2010 17:19:43 +0000</pubDate>
		<dc:creator>tayyabtariq</dc:creator>
				<category><![CDATA[Microsoft Technologies]]></category>
		<category><![CDATA[Block ports in windows 7]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Port Blocking]]></category>

		<guid isPermaLink="false">http://tayyab.xenoglaux-solutions.com/2010/05/09/how-to-block-specific-ports-in-windows-7/</guid>
		<description><![CDATA[Hello everyone, I have learnt from some Facebook status updates that there is some internet explorer related security threat on the loose. It has also endangered IM like Yahoo and Skype. In this wake Microsoft has recommended that TCP ports 139 and 445 be blocked. Here is how to accomplish this in Windows 7;
 
1. [...]]]></description>
			<content:encoded><![CDATA[<p>Hello everyone, I have learnt from some <a href="http://facebook.com" target="_blank">Facebook</a> status updates that there is some internet explorer related security threat on the loose. It has also endangered IM like Yahoo and Skype. In this wake Microsoft has recommended that TCP ports 139 and 445 be blocked. Here is how to accomplish this in Windows 7;</p>
<p> <span id="more-202"></span>
<p>1. Go to <strong>Control Panel</strong> and open <strong>Windows</strong> <strong>Firewall</strong>.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/05/image4.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/05/image_thumb4.png" width="504" height="301" /></a> </p>
<p>2. Click on <strong>Advanced Settings</strong> in the left panel.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/05/image5.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/05/image_thumb5.png" width="504" height="362" /></a> </p>
<p>3. In the <strong>Advanced Settings</strong> panel, click on <strong>Inbound Rules</strong> in the left column.</p>
<p>4. In the <strong>Inbound Rules</strong> window, click on <strong>New Rule</strong> in the right column.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/05/image6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/05/image_thumb6.png" width="504" height="362" /></a> </p>
<p>5. In the <strong>New Inbound Rule Wizard</strong>, select <strong>Port</strong> and click next.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/05/image7.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/05/image_thumb7.png" width="504" height="408" /></a> </p>
<p>6. In the next window, select the port type (TCP) and enter the port numbers separated by a coma and click Next. </p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/05/image8.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/05/image_thumb8.png" width="504" height="408" /></a> </p>
<p>7. In the next window, select <strong>Block the Connection</strong> and click next.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/05/image9.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/05/image_thumb9.png" width="504" height="408" /></a> </p>
<p>8. Select all the domains you want to apply this rule to and click next.</p>
<p>9. Enter the name and description of the rule and click Finish. You are done!</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2010/05/09/how-to-block-specific-ports-in-windows-7/" target="_blank"><img src="http://tayyab.xenoglaux-solutions.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2010/05/09/how-to-block-specific-ports-in-windows-7/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://tayyab.xenoglaux-solutions.com/2010/05/09/how-to-block-specific-ports-in-windows-7/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Arrays in C++</title>
		<link>http://tayyab.xenoglaux-solutions.com/2010/04/25/arrays-in-c-2/</link>
		<comments>http://tayyab.xenoglaux-solutions.com/2010/04/25/arrays-in-c-2/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 14:19:23 +0000</pubDate>
		<dc:creator>tayyabtariq</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Computer Programming]]></category>
		<category><![CDATA[Microsoft Technologies]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[Arrays]]></category>
		<category><![CDATA[Arrays of Arrays]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Jagged Arrays]]></category>
		<category><![CDATA[Managed C++]]></category>
		<category><![CDATA[Visual Studio.NET]]></category>

		<guid isPermaLink="false">http://tayyab.xenoglaux-solutions.com/2010/04/25/arrays-in-c-2/</guid>
		<description><![CDATA[Introduction
In some programs, you may need to represent a list of items that share some characteristics. You can declare as many variables as necessary to represent such items. Here is an example of 5 numbers declared in a program: 
// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In some programs, you may need to represent a list of items that share some characteristics. You can declare as many variables as necessary to represent such items. Here is an example of 5 numbers declared in a program: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    int number1 = 266;
    int number1 = -4683;
    int number1 = -364;
    int number1 = 1450;
    int number1 = 8;

    Console::WriteLine();
    return 0;
}</pre>
<p>If you want to use a group of objects that are of the same kind, C++ allows you to identify them as one variable. An array is a group of variables that shared the same characteristics. </p>
<h5>Note:</h5>
<p>
  <br />Arrays in Managed C++ are a little different than those traditionally used in C++ because the Microsoft .NET Framework introduced a new way of declaring and using arrays, which also has to do with inherited classes. Because this can be a long and arduous subject, we will use arrays only as they are used and implemented in managed classes.</p>
<h2>Array Declaration </h2>
<p>An array is a group of values of the same kind or the same data type. Because the items are considered in a group, they are declared as one variable but the declaration must indicate that the variable represents various items. The items that are part of the group are also referred to as members of the array. To declare an array, you must give it a name. </p>
<p>In C++, the formula to declare an array is </p>
<pre><i>DataType</i> <i>ArrayName</i>[<i>Dimension</i>];</pre>
<p>With this formula, an array would be declared as a value type. C++&#8217; arrays can be declared either on the stack as in the above formula or on the heap. Managed C++ formally introduces the idea of declaring an array on the heap. Based on this, (most) arrays in Managed C++ are referred to as managed arrays. In this case, the formula to declare a managed array is: </p>
<pre><i>DataType</i> <i>ArrayName</i>[] = new <i>DataType</i>[<i>Dimension</i>];</pre>
<p>Another equivalent formula is: </p>
<pre><i>DataType</i> <i>ArrayName</i> __gc[] = new <i>DataType</i> __gc[<i>Dimension</i>];</pre>
<p>Therefore, the declaration of a managed array starts by specifying a data type, the <i>DataType</i> in our syntax. This indicates the kind of values shared by the members of the array. It also specify the amount of memory space that each member of the array will need to store its value. Like any other variable, an array must have a name, which is the <i>ArrayName</i> in our syntax. The name of the array must be followed by an opening and a closing square brackets &quot;[]&quot;. To indicate that you are declaring a managed array, you must assign the same data type as a managed type, using the <b>new</b> keyword. Once again, the data type must be followed by square brackets. This time, inside of the square brackets, you must type the number of items that the array is made of; that is the <i>Dimension</i> in our syntax. </p>
<p>To create a managed array, the data type can be a normal C/C++ data type such as int, double, or .NET value type such as <b>Int32</b>, <b>Double</b>, etc. Here is an example: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    Double Number[] = new Double[5];

    Console::WriteLine(S&quot;&quot;);
    return 0;
}</pre>
<p>To re-enforce the idea of declaring a managed array, you can optionally type the <b>__gc</b> keyword to the left of the square brackets. You can type it either on only one side of the assignment operator or on both sides. Therefore, the following declarations are equivalents: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    Double Number1[]      = new Double[5];
    Double Number2 __gc[] = new Double[5];
    Double Number3[]      = new Double __gc[5];
    Double Number4 __gc[] = new Double __gc[5];

    Console::WriteLine();
    return 0;
}</pre>
<p>When declaring a managed array, you must use the <b>new</b> operator to indicate to the compiler that the variable would be declared on the heap. Because the <b>new</b> operator is explicit enough, you can omit the <b>__gc</b> keyword. Also, you don&#8217;t have to perform the whole declaration at the same time but you must have requested that memory be allocated to the array before it can be used. Based on this, you can first declare the variable with the left part of the assignment operator. Then, when you are ready, you can allocate memory to the variable and specify the number of members of the array. When doing this, type the name of the variable without the square brackets and type the right side of our syntax. Here is an example: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    Double number[];
    // You can't yet use the array

    Console::WriteLine(S&quot;The Wonderful World of Managed C++!&quot;);

    number = __gc new Double[5];
    // Now the array is ready

    Console::WriteLine();
    return 0;
}</pre>
<p>We mentioned that, when declaring the array, you should specify the number of members of the array with the <i>Dimension</i> in our syntax. After declaring the array, if you want, you can reduce or increase the number of items by simply performing a new assignment to the variable and indicating the new desired <i>Dimension</i>. Here is an example: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    Double number[];
    // You can't yet use the array

    Console::WriteLine(S&quot;The Wonderful World of Managed C++!&quot;);

    number = __gc new Double[5];
    // Now the array is ready

    // The new dimension of the array
    number = new Double[8];

    Console::WriteLine();
    return 0;
}</pre>
<h2>Initializing an Array</h2>
<p>When declaring an array, before using it, we saw that you must specify the number of members of the array. This declaration allocates an amount of memory space to the variable. The first member of the array takes a portion of this space. The second member of the array occupies memory next to it: </p>
<p><b>Array Variable</b></p>
<p>Member1<br />
  <br />Member2</p>
<p>Member3</p>
<p>Member4</p>
<p>Member5</p>
<p>Each member of the array can be accessed using its position. The position is also referred to as an index. The members of an array are arranged starting at index 0, followed by index 1, then index 2, etc. This system of counting is referred to as &quot;zero-based&quot; because the counting starts at 0. To locate a member, type the name of the variable followed by an opening and a closing square brackets. Inside the bracket, type the zero-based index of the desired member. After locating the desired member of the array, you can assign it a value, exactly as you would any regular variable. Here is an example: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    Double number[] = __gc new Double[5];

    number[0] = 643.18;
    number[1] = 9.64;
    number[2] = 48.05;
    number[3] = 14.26;
    number[4] = 62.55;

    Console::WriteLine(S&quot;&quot;);
    return 0;
}</pre>
<p>In the same way, you can retrieve the value of a member of an array based on its index. Such a value can be displayed to the user as follows: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    Double number[] = __gc new Double[5];

    number[0] = 643.18;
    number[1] = 9.64;
    number[2] = 48.05;
    number[3] = 14.26;
    number[4] = 62.55;

    Console::WriteLine(S&quot;Value 1: {0}&quot;, __box(number[0]));
    Console::WriteLine(S&quot;Value 2: {0}&quot;, __box(number[1]));
    Console::WriteLine(S&quot;Value 3: {0}&quot;, __box(number[2]));
    Console::WriteLine(S&quot;Value 4: {0}&quot;, __box(number[3]));
    Console::WriteLine(S&quot;Value 5: {0}&quot;, __box(number[4]));

    number = new Double[8];

    Console::WriteLine(S&quot;&quot;);
    return 0;
}</pre>
<p>This would produce: </p>
<pre>Value 1: 643.18
Value 2: 9.64
Value 3: 48.05
Value 4: 14.26
Value 5: 62.55

Press any key to continue</pre>
<p>When it comes to initializing a managed array, you don&#8217;t have to access each member of the array and initialize them individually. That technique is used if you don&#8217;t yet have the values of the items at the time you are declaring the array. If you know the values of the members of the managed array at the time you are declaring its variable, you can declare and initialize the whole array at the same time. The formula you would use is: </p>
<pre><i>DataType</i> <i>VariableName</i> __gc[] = { <i>Values Separated By Commas</i> };</pre>
<p>This formula is almost the same used in C/C++ with one difference. If you omit the <b>__gc</b> keyword, the array would be a regular one as used in C/C++. The alternative is to type the __gc keyword to the left of the square brackets. If you do this, two features would automatically be applied to your array. First, the array would be garbage collected, that is, cleaned up by the garbage collector; therefore becoming a managed array. Second, the array becomes automatically derived from the .NET&#8217;s Array class, which gives it access to the properties and methods of that class.</p>
<p>If you use the formula we used earlier with the number variable, the data type must be a .NET value type such as <b>Int32</b>, <b>Double</b>, <b>Single</b>, etc. If you use the above formula to declare and initialize your array, the data type can be a regular C/C++ type (such as <b>int</b>, long, or <b>double</b>) or a .NET value type (such as <b>Int32</b> or <b>Double</b>). Here is an example:</p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    double number __gc[] = { 79.31, 47.59, 749.75, 9.07, 9.44 };

    Console::WriteLine(S&quot;Value 1:  {0}&quot;, __box(number[0]));
    Console::WriteLine(S&quot;Value 2:  {0}&quot;, __box(number[1]));
    Console::WriteLine(S&quot;Value 3:  {0}&quot;, __box(number[2]));
    Console::WriteLine(S&quot;Value 4:  {0}&quot;, __box(number[3]));
    Console::WriteLine(S&quot;Value 5:  {0}&quot;, __box(number[4]));

    Console::WriteLine(S&quot;&quot;);
    return 0;
}</pre>
<p>This would produce:</p>
<pre>Value 1:  79.31
Value 2:  47.59
Value 3:  749.75
Value 4:  9.07
Value 5:  9.44

Press any key to continue</pre>
<h2>Multidimensional Arrays</h2>
<h2>Introduction</h2>
<p>The arrays we have used so far are referred to as single or one-dimensional arrays because they use a single group of items that can classified in a single column. In some cases, you may want to divided the list in two or more sections. For example, here is a list of numbers divided in various columns: </p>
<p>Sunday<br />
  <br />Monday</p>
<p>Tuesday</p>
<p>Wednesday</p>
<p>Thursday</p>
<p>Friday</p>
<p>Saturday</p>
<p>Week 1<br />
  <br />1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>Week 2<br />
  <br />8</p>
<p>9</p>
<p>10</p>
<p>11</p>
<p>12</p>
<p>13</p>
<p>14</p>
<p>Week 3<br />
  <br />15</p>
<p>16</p>
<p>17</p>
<p>18</p>
<p>19</p>
<p>20</p>
<p>21</p>
<p>Week 4<br />
  <br />22</p>
<p>23</p>
<p>24</p>
<p>25</p>
<p>26</p>
<p>27</p>
<p>28</p>
<p>A multi-dimensional array is one that still includes items of the same type but the group is made of sub-divisions following an arrangement an arrangement of your choice. </p>
<h2>Two-Dimensional Arrays</h2>
<p>Imagine you create two lists of items declared in two variables as follows: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    <b>Double number1 __gc[] = new Double __gc[5];
    Double number2 __gc[] = new Double __gc[5];</b>

    number1[0] = 643.18;
    number1[1] = 9.64;
    number1[2] = -48.05;
    number1[3] = 14.26;
    number1[4] = 62.55;

    number2[0] = 124.45;
    number2[1] = -62.84;
    number2[2] = 508.06;
    number2[3] = 92.68;
    number2[4] = -44.82;

    Console::WriteLine(S&quot;Value 1:  {0}&quot;, __box(number1[0]));
    Console::WriteLine(S&quot;Value 2:  {0}&quot;, __box(number1[1]));
    Console::WriteLine(S&quot;Value 3:  {0}&quot;, __box(number1[2]));
    Console::WriteLine(S&quot;Value 4:  {0}&quot;, __box(number1[3]));
    Console::WriteLine(S&quot;Value 5:  {0}&quot;, __box(number1[4]));

    Console::WriteLine(S&quot;Value 6:  {0}&quot;, __box(number2[0]));
    Console::WriteLine(S&quot;Value 7:  {0}&quot;, __box(number2[1]));
    Console::WriteLine(S&quot;Value 8:  {0}&quot;, __box(number2[2]));
    Console::WriteLine(S&quot;Value 9:  {0}&quot;, __box(number2[3]));
    Console::WriteLine(S&quot;Value 10: {0}&quot;, __box(number2[4]));

    Console::WriteLine(S&quot;&quot;);
    return 0;
}</pre>
<p>Instead of having two lists that represent the same types of values, you can declare a single array variable and divide its list of items in two. A two-dimensional array is an array made of two lists of items of the same data type. To declare a two-dimensional array, use the following formula: </p>
<pre><i>DataType</i> <i>ArrayName</i>[,] = new <i>DataType</i>[<i>Dimension1,Dimension2</i>];</pre>
<p>Once again, you can optionally type the __gc keyword to the left of square brackets. The square brackets to the left of the assignment operator must have only a comma. Inside of the square brackets to the right side of the assignment, you must specify two numbers separated by a comma. The first number indicates the number of lists that the array contains. For a two-dimensional array, this number must be 2. The right value indicates the number of items that each list would contain. Here is an example: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    Double number __gc[,] = new Double __gc[2,5];

    Console::WriteLine(S&quot;&quot;);
    return 0;
}</pre>
<p>In this case, the number variable is a two-dimensional array. In other words, the variable represents two lists. Each list contains 5 numbers. </p>
<p>To access a member of the array, type the name of the variable followed by the square brackets. Inside of the brackets, type the zero-based index of the desired list. The first list has an index of 0 while the second list has an index of 1. Then type the comma. On the right side of the comma, type the zero-based index of the member you want to access. Once you have accessed a member of the array, you can either assign it a value or retrieve the value it is currently holding. Here are examples: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    Double number __gc[,] = new Double __gc[2,5];

    number[0,0] = 643.18;
    number[0,1] = 9.64;
    number[0,2] = -48.05;
    number[0,3] = 14.26;
    number[0,4] = 62.55;

    number[1,0] = 124.45;
    number[1,1] = -62.84;
    number[1,2] = 508.06;
    number[1,3] = 92.68;
    number[1,4] = -44.82;

    Console::WriteLine(S&quot;Value 1:  {0}&quot;, __box(number[0,0]));
    Console::WriteLine(S&quot;Value 2:  {0}&quot;, __box(number[0,1]));
    Console::WriteLine(S&quot;Value 3:  {0}&quot;, __box(number[0,2]));
    Console::WriteLine(S&quot;Value 4:  {0}&quot;, __box(number[0,3]));
    Console::WriteLine(S&quot;Value 5:  {0}&quot;, __box(number[0,4]));

    Console::WriteLine(S&quot;Value 6:  {0}&quot;, __box(number[1,0]));
    Console::WriteLine(S&quot;Value 7:  {0}&quot;, __box(number[1,1]));
    Console::WriteLine(S&quot;Value 8:  {0}&quot;, __box(number[1,2]));
    Console::WriteLine(S&quot;Value 9:  {0}&quot;, __box(number[1,3]));
    Console::WriteLine(S&quot;Value 10: {0}&quot;, __box(number[1,4]));

    Console::WriteLine(S&quot;&quot;);
    return 0;
}</pre>
<p>This would produce: </p>
<pre>Value 1:  643.18
Value 2:  9.64
Value 3:  -48.05
Value 4:  14.26
Value 5:  62.55
Value 6:  124.45
Value 7:  -62.84
Value 8:  508.06
Value 9:  92.68
Value 10: -44.82

Press any key to continue</pre>
<h2>Multi-Dimensional Arrays</h2>
<p>A multi-dimensional array is a list of a list of a list, etc. In other words, it is a list that contains other lists while these other lists may contain other lists. For example, a three-dimensional array is one that contains 3 lists; each of the 3 lists contains a certain number of lists; then each list inside contains a list of items. </p>
<p>To declare a multi-dimensional array, in the square brackets, type the number of comma minus the total number of lists. For example, the square brackets of a three-dimensional array would have 2 commas. The square brackets of a 5-dimensional array would have 4 commas. In the square brackets on the right side of the assignment operator must indicate the dimension of each level of list. Consider the following declaration: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    Double hoursWorked __gc[,,] = new Double[6,3,5];

    Console::WriteLine();
    return 0;
}</pre>
<p>In this declaration, the variable represents 6 lists. Each of the 6 lists is made of its own 3 lists. Each of the 3 lists contains 5 items. Another ways to illustrate this is that the array represents 6 months work for a contractor. In each of the six months, the contractor worked for 3 weeks. In each of the 3 weeks, the contractor worked for 5 days. </p>
<p>You can access each member of a multi-dimensional array using its index. In the above example, the first month has an index of 0 while the third month has an index of 2. Everything else is as done for the other dimensional arrays. </p>
<p>The String as an Array and Characters</p>
<h2>An Array of Characters</h2>
<p>In C/C++, you can declare a string variable as an array of characters. Here is an example: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    char School[] = &quot;American College of Computer &amp; Information Sciences&quot;;

    Console::Write(&quot;School Name: &quot;);
    Console::WriteLine(School);

    Console::WriteLine(S&quot;&quot;);
    return 0;
}</pre>
<p>This would produce: </p>
<pre>School Name: American College of Computer &amp; Information Sciences

Press any key to continue</pre>
<p>In various previous examples, we used the .NET&#8217;s <b>String</b> class to declare and process string variables. In some cases, you will need access to one character inside of a string. In C/C++, if you declare a string using an array of characters as done above, to access an individual character, you type the name of the variable followed by square brackets. Inside of the square brackets, you can type the 0-based index of the character you want to access. Remember that the C/C++ <b>char</b> data type is an 8-bit value (to access a character, you should use its <b>Char</b> or <b>__wchar_t</b> type). Here is an example: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    char School[] = &quot;American College of Computer &amp; Information Sciences&quot;;
    Char First    = School[0];
    Char Second   = School[9];
    Char Third    = School[20];
    Char Fourth   = School[31];
    Char Fifth    = School[43];

    Console::Write(&quot;School Name: &quot;);
    Console::WriteLine(School);
    Console::WriteLine(S&quot;Abbreviation: {0}{1}{2}{3}{4}&quot;,
	              __box(First), __box(Second), __box(Third),
	              __box(Fourth), __box(Fifth));

    Console::WriteLine(S&quot;&quot;);
    return 0;
}</pre>
<p>This would produce: </p>
<pre>School Name: American College of Computer &amp; Information Sciences
Abbreviation: ACCIS

Press any key to continue</pre>
<p>The Characters of a String Class Value</p>
<p>Many libraries that feature a string class, such as the ATL&#8217;s <b>basic_string</b> class, the MFC&#8217;s <b>CString</b> class, or the VCL&#8217;s <b>AnsiString</b> class provide you the same mechanism (by overloading the [] operator). The Microsoft .NET Framework&#8217;s <b>String</b> class provides a different functionality. If you declare a String variable and want to access any of its characters, the String class provides a Chars property that uses square brackets to locate a character. This is done using the same approach as above except that you must call the Chars property. Here is an example of how this can be done: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    String* School = &quot;American College of Computer &amp; Information Sciences&quot;;
    Char First    = School-&gt;Chars[0];
    Char Second   = School-&gt;Chars[9];
    Char Third    = School-&gt;Chars[20];
    Char Fourth   = School-&gt;Chars[31];
    Char Fifth    = School-&gt;Chars[43];

    Console::Write(&quot;School Name: &quot;);
    Console::WriteLine(School);
    Console::WriteLine(S&quot;Abbreviation: {0}{1}{2}{3}{4}&quot;,
	              __box(First), __box(Second), __box(Third),
	              __box(Fourth), __box(Fifth));

    Console::WriteLine(S&quot;&quot;);
    return 0;
}</pre>
<p>It would produce the same result.</p>
<h2>Arrays and Functions</h2>
<h3>An Array as Argument</h3>
<p>An array can be passed to a function as argument. An array can also be returned by a function. To specify that a function takes an array as argument, declare the function as you would do for any regular function. In the parentheses of the function, declare the array with the __gc keyword as you have done so far. Here is an example: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

void ShowNumbers(double n __gc[]);

int _tmain()
{
    // TODO: Please replace the sample code below with your own.

    Console::WriteLine(S&quot;&quot;);
    return 0;
}</pre>
<p>When implementing the function, proceed as you would do normally. If you want to access the members of the array, use the same technique we have used so far, accessing each member of the array by its index. When you call the function from another function, simply pass the name of the array as argument. This would be done as follows:</p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

void ShowNumbers(double n __gc[]);

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    Double number[]= { 643.18, 9.64, 48.05, 14.26, 62.55 };

    ShowNumbers(number);

    Console::WriteLine(S&quot;&quot;);
    return 0;
}

void ShowNumbers(double Nbr __gc[])
{
    Console::WriteLine(S&quot;Value 1: {0}&quot;, __box(Nbr[0]));
    Console::WriteLine(S&quot;Value 2: {0}&quot;, __box(Nbr[1]));
    Console::WriteLine(S&quot;Value 3: {0}&quot;, __box(Nbr[2]));
    Console::WriteLine(S&quot;Value 4: {0}&quot;, __box(Nbr[3]));
    Console::WriteLine(S&quot;Value 5: {0}&quot;, __box(Nbr[4]));
}</pre>
<p>This would produce: </p>
<pre>Value 1: 643.18
Value 2: 9.64
Value 3: 48.05
Value 4: 14.26
Value 5: 62.55

Press any key to continue</pre>
<p>If you create a function that takes a non-managed array as argument, you usually would pass an additional argument that carries the size of the array. On the other hand, if you create a function that takes a managed array as argument, since the array would inherit from the Array class, the argument would automatically carry its dimension from the Length property of the Array class. Therefore, with a managed array as argument, you don&#8217;t have to specify the number of members to the function; the compiler would figure that out. </p>
<h3>Returning an Array</h3>
<p>Whether in C/C++ or Managed C++, an array is (always) passed as a reference. Although in C/C++, there is no formal way to return an array from a function, because an array is passed as a reference, it is very easy to return an array. Actually, this technique is used in C++ as an accessory, not as a means. Managed C++ formal features the idea of returning an array from a function. Although this is a new feature not available in C/C++, it is very easy to use, so easy that there is very little effort to implement this valuable addition. </p>
<p>To indicate that a function would return an array, if you are only declaring the function, type empty square brackets between the function&#8217;s parentheses and its semi-colon. Here is an example: </p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

Double GetNumbers()[];

void ShowNumbers(double n __gc[]);

int _tmain()
{
    // TODO: Please replace the sample code below with your own.

    Console::WriteLine(S&quot;&quot;);
    return 0;
}</pre>
<p>When defining the function, type the square brackets between the function&#8217;s parentheses and its opening curly bracket. In the body of the function, you can declare an array, do what you want with it, and then return it as the return value of the function.</p>
<p>When calling a function that returns an array, proceed with the rules you would use for any other function. For example, you can call the function in another and use it as you see fit. You can also assign the function to an array variable in order to initialize the variable. Here is an example:</p>
<pre>// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include &quot;stdafx.h&quot;

#using &lt;mscorlib.dll&gt;

using namespace System;

Double GetNumbers()[];

void ShowNumbers(double n __gc[]);

int _tmain()
{
    // TODO: Please replace the sample code below with your own.
    <b>Double no __gc[] = GetNumbers();</b>
    ShowNumbers(no);

    Console::WriteLine(S&quot;&quot;);
    return 0;
}

Double GetNumbers()<b>[]</b>
{
    Double number[] = { 643.18, 9.64, 48.05, 14.26, 62.55 };

    return number;
}

void ShowNumbers(double Nbr __gc[])
{
    Console::WriteLine(S&quot;Value 1: {0}&quot;, __box(Nbr[0]));
    Console::WriteLine(S&quot;Value 2: {0}&quot;, __box(Nbr[1]));
    Console::WriteLine(S&quot;Value 3: {0}&quot;, __box(Nbr[2]));
    Console::WriteLine(S&quot;Value 4: {0}&quot;, __box(Nbr[3]));
    Console::WriteLine(S&quot;Value 5: {0}&quot;, __box(Nbr[4]));
}</pre>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2010/04/25/arrays-in-c-2/" target="_blank"><img src="http://tayyab.xenoglaux-solutions.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2010/04/25/arrays-in-c-2/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://tayyab.xenoglaux-solutions.com/2010/04/25/arrays-in-c-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Ribbon Control with Windows Forms: What I Learnt Today?</title>
		<link>http://tayyab.xenoglaux-solutions.com/2010/04/19/using-ribbon-control-with-windows-forms-what-i-learnt-today/</link>
		<comments>http://tayyab.xenoglaux-solutions.com/2010/04/19/using-ribbon-control-with-windows-forms-what-i-learnt-today/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 17:11:52 +0000</pubDate>
		<dc:creator>tayyabtariq</dc:creator>
				<category><![CDATA[Computer Programming]]></category>
		<category><![CDATA[Microsoft Technologies]]></category>
		<category><![CDATA[WILT]]></category>
		<category><![CDATA[Windows Forms]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Ribbon]]></category>
		<category><![CDATA[Ribbon control]]></category>
		<category><![CDATA[Visual Studio.NET]]></category>

		<guid isPermaLink="false">http://tayyab.xenoglaux-solutions.com/2010/04/19/using-ribbon-control-with-windows-forms-what-i-learnt-today/</guid>
		<description><![CDATA[Recently I have been exploring the use of Ribbon Control. Yesterday, I posted a tutorial on its use with Windows Workflow Foundation. However, I am far more comfortable developing applications with Windows Forms compared to WPF. So, I searched for Ribbon Control for Windows Forms. Although I found an open source version here, there was [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">Recently I have been exploring the use of <a href="http://msdn.microsoft.com/en-us/library/cc872782.aspx" target="_blank">Ribbon Control</a>. Yesterday, I posted <a href="http://tayyab.xenoglaux-solutions.com/2010/04/18/create-a-simple-wpf-ribbon-control-what-i-learnt-today/" target="_blank">a tutorial</a> on its use with Windows Workflow Foundation. However, I am far more comfortable developing applications with Windows Forms compared to WPF. So, I searched for Ribbon Control for Windows Forms. Although I found an open source version <a href="http://ribbon.codeplex.com" target="_blank">here</a>, there was no associated tutorial. So I decided to write one. In this tutorial I will explain how to create a simple windows forms application with a Ribbon Control and how to add buttons. </p>
<p align="justify">If you need the basic concepts about Ribbon Control, read the first part of my <a href="http://tayyab.xenoglaux-solutions.com/2010/04/18/create-a-simple-wpf-ribbon-control-what-i-learnt-today/" target="_blank">previous post</a>.</p>
<div align="justify"><span id="more-186"></span></div>
<p align="justify">1. Download the Ribbon Control binaries <a href="http://ribbon.codeplex.com/" target="_blank">here</a>.</p>
<p align="justify">2. Create a Windows Forms Visual Studio Project.</p>
<p align="justify">3. Add reference to the downloaded System.Windows.Forms.Ribbon.dll</p>
<p align="justify">4. Declare a System.Windows.Forms.Ribbon reference in Designer.cs file of your form and create an object (you also need to add some more supporting code). Be sure to include System.Windows.Forms to your code. Your .Designer.cs file should look somewhat like this;</p>
<div align="justify">
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">using</span> System.Windows.Forms;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">namespace</span> DMProject</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">partial</span> <span style="color: #0000ff">class</span> Form1</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #008000">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #008000">/// Required designer variable.</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #008000">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">private</span> System.ComponentModel.IContainer components = <span style="color: #0000ff">null</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">private</span> System.Windows.Forms.Ribbon ribbon1 = <span style="color: #0000ff">null</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #008000">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #008000">/// Clean up any resources being used.</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #008000">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #008000">/// &lt;param name=&quot;disposing&quot;&gt;true if managed resources should be disposed; otherwise, false.&lt;/param&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">protected</span> <span style="color: #0000ff">override</span> <span style="color: #0000ff">void</span> Dispose(<span style="color: #0000ff">bool</span> disposing)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span> (disposing &amp;&amp; (components != <span style="color: #0000ff">null</span>))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                components.Dispose();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">base</span>.Dispose(disposing);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #cc6633">#region</span> Windows Form Designer generated code</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #008000">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #008000">/// Required method for Designer support - do not modify</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #008000">/// the contents of this method with the code editor.</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #008000">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> InitializeComponent()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">this</span>.ribbon1 = <span style="color: #0000ff">new</span> System.Windows.Forms.Ribbon();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">this</span>.SuspendLayout();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #008000">// </span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #008000">// ribbon1</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #008000">// </span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #008000">// </span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #008000">// Form1</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #008000">// </span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">this</span>.AutoScaleDimensions = <span style="color: #0000ff">new</span> System.Drawing.SizeF(6F, 13F);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">this</span>.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">this</span>.ClientSize = <span style="color: #0000ff">new</span> System.Drawing.Size(284, 262);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">this</span>.Controls.Add(<span style="color: #0000ff">this</span>.ribbon1);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">this</span>.Name = <span style="color: #006080">&quot;Form1&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">this</span>.Text = <span style="color: #006080">&quot;Form1&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">this</span>.ResumeLayout(<span style="color: #0000ff">false</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #cc6633">#endregion</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></div>
</p></div>
</div>
<p align="justify">
<p align="justify">Your Windows Form Should look like this;</p>
<p align="justify"><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image9.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image_thumb8.png" width="304" height="304" /></a> </p>
<p align="justify">From this point onward, adding controls to the ribbon should be easy.</p>
<p align="justify">5. To add a tab to your ribbon control, click ‘Add Tab’. I have added three tabs; Home, Data Manipulation and Visualization. As with any control, you can change the properties of the tabs using the properties grid.</p>
<p align="justify"><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image10.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image_thumb9.png" width="504" height="285" /></a> </p>
<p align="justify">You can now compile and run the application, it would look like the screenshot above.</p>
<p align="justify">6. The next step is to add a panel to contain the buttons. To do this, click the ‘Add Panel’ button. Change the properties of the panels as desired.</p>
<p align="justify">7. Once the panels have been created, click a panel. The property grid shows options for the panel. Besides ‘Add Button’, these options include ‘Add Button List’, ‘Add Item Group’, ‘Add Separator’ etc. Click the ‘Add Button’ command. A button is created. You can use the property grid to set the text, tool tip and image for the button.</p>
<p align="justify">To add images to these buttons, you first have add the PNG images to your project resources. To do this, right click on your project and click Properties. In the resources tab, select ‘Add Existing File’ and browse for your PNG icons.</p>
<p align="justify"><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image11.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image_thumb10.png" width="504" height="316" /></a> </p>
<p align="justify">Congratulations! you have successfully added a ribbon control to your Windows Forms Application. You are good to go!</p>
<p align="justify"><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image12.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image_thumb11.png" width="404" height="229" /></a></p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2010/04/19/using-ribbon-control-with-windows-forms-what-i-learnt-today/" target="_blank"><img src="http://tayyab.xenoglaux-solutions.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2010/04/19/using-ribbon-control-with-windows-forms-what-i-learnt-today/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://tayyab.xenoglaux-solutions.com/2010/04/19/using-ribbon-control-with-windows-forms-what-i-learnt-today/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Create A Simple WPF Ribbon Control: What I learnt Today?</title>
		<link>http://tayyab.xenoglaux-solutions.com/2010/04/18/create-a-simple-wpf-ribbon-control-what-i-learnt-today/</link>
		<comments>http://tayyab.xenoglaux-solutions.com/2010/04/18/create-a-simple-wpf-ribbon-control-what-i-learnt-today/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 17:45:51 +0000</pubDate>
		<dc:creator>tayyabtariq</dc:creator>
				<category><![CDATA[Computer Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[WILT]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Ribbon]]></category>
		<category><![CDATA[Ribbon control]]></category>
		<category><![CDATA[Visual Studio.NET]]></category>
		<category><![CDATA[What I Learnt Today?]]></category>
		<category><![CDATA[Windows Presentation Foundation]]></category>

		<guid isPermaLink="false">http://tayyab.xenoglaux-solutions.com/2010/04/18/create-a-simple-wpf-ribbon-control-what-i-learnt-today/</guid>
		<description><![CDATA[In this tutorial I would explain how to create a simple Ribbon Control using Windows Presentation Foundation. 
 
Image Courtesy MSDN.

The WPF team is sharing new WPF Ribbon control starting on Monday, October 27, 2008! Binaries and source code for the Ribbon can be downloaded at the Office UI Licensing site.
So, your first step is [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">In this tutorial I would explain how to create a simple <a href="http://msdn.microsoft.com/en-us/library/cc872782.aspx" target="_blank">Ribbon Control</a> using <a href="http://msdn.microsoft.com/en-us/library/ms754130.aspx" target="_blank">Windows Presentation Foundation</a>. </p>
<p align="justify"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image.png" width="504" height="209" /> </p>
<p align="justify"><em><strong>Image Courtesy MSDN.</strong></em></p>
<div align="justify"><span id="more-171"></span></div>
<p align="justify">The WPF team is sharing new WPF Ribbon control starting on Monday, October 27, 2008! Binaries and source code for the Ribbon can be downloaded at the Office UI Licensing site.</p>
<p align="justify">So, your first step is to go to Office UI Licensing site and get yourself a free WPF ribbon control. You must accept and sign license (it’s not a big deal) and download free WPF ribbon control. <strong><a href="http://msdn.microsoft.com/hr-hr/office/aa973809%28en-us%29.aspx">Just follow this link</a>.</strong></p>
<h2 align="justify">What is Ribbon Control?</h2>
<p align="justify">Ribbons are the modern way to help users find, understand, and use commands efficiently and directly—with a minimum number of clicks, with less need to resort to trial-and-error, and without having to refer to Help.</p>
<p align="justify">The preview version of the WPF Ribbon includes many of the features which Independent Software Vendors (ISVs) need to add a Ribbon control to their WPF applications. Ribbon is a command bar that organizes a program&#8217;s features into a series of tabs at the top of a window. The Ribbon UI was designed by Microsoft Office to increase discoverability of features and functions, enable quicker learning of the program as a whole, and make users feel more in control of their experience with the program. The Ribbon is designed to replace the traditional menu bar and toolbars. The WPF Ribbon will include all of the basic Ribbon features and functionality, including tabs, groups, controls (buttons, split buttons, galleries, etc.), title bar integration of the application menu button and quick access toolbar, and resizing with dynamic layout.</p>
<p align="justify">For more information, follow <a href="http://msdn.microsoft.com/en-us/library/cc872782.aspx" target="_blank">this link</a>.</p>
<p align="justify">&#160;</p>
<h2 align="justify">Step 1: Adding The Ribbon Control to your WPF Application</h2>
<p align="justify">1. Create a new WPF Project using Visual Studio .NET 2008.</p>
<p align="justify">2. Add a reference to “RibbonControlsLibrary.dll” that you downloaded earlier.</p>
<p align="justify"><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image_thumb.png" width="504" height="316" /></a> </p>
<p align="justify">3. Add the XAML Reference to the DLL you have just added to your project by adding this line to your XAML code.</p>
<p align="justify">xmlns:r=&quot;clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary&quot;</p>
<p align="justify">4. Change the root element of your XAML code to r:RibbonWindow instead of Window. </p>
<div align="justify">
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonWindow</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;FirstRibbonApplication.Window1&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #ff0000">xmlns:r</span><span style="color: #0000ff">=&quot;clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     <span style="color: #ff0000">Title</span><span style="color: #0000ff">=&quot;Window1&quot;</span> <span style="color: #ff0000">Height</span><span style="color: #0000ff">=&quot;300&quot;</span> <span style="color: #ff0000">Width</span><span style="color: #0000ff">=&quot;300&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonWindow</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></div>
</p></div>
</div>
<p align="justify">5. Add the r:Ribbon tag to your XAML code.</p>
<div align="justify">
<pre>&lt;r:Ribbon Title=&quot;WPF Ribbon - Document1&quot; x:Name=&quot;ribbon&quot; /&gt;</pre>
</div>
<p align="justify">Your XAML code should now look like this;</p>
<div align="justify">
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonWindow</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;FirstRibbonApplication.Window1&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #ff0000">xmlns:r</span><span style="color: #0000ff">=&quot;clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #ff0000">Title</span><span style="color: #0000ff">=&quot;Window1&quot;</span> <span style="color: #ff0000">Height</span><span style="color: #0000ff">=&quot;300&quot;</span> <span style="color: #ff0000">Width</span><span style="color: #0000ff">=&quot;300&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">       <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:Ribbon</span> <span style="color: #ff0000">Title</span><span style="color: #0000ff">=&quot;WPF Ribbon - Document1&quot;</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;ribbon&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonWindow</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></div>
</p></div>
</div>
<p align="justify">Congratulations! you have successfully added a ribbon control to your WPF application. Before you can see the control you would need to make a few changes to the accompanying cs file. Open the cs and add the following library and make sure that the partial class inherits from RibbonWindow instead of Window.</p>
<div align="justify">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">using</span> Microsoft.Windows.Controls.Ribbon;</pre>
<p><!--CRLF--></div>
</div>
<p align="justify">
<p align="justify">Compile and run the application to see the results.</p>
<p align="justify"><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image_thumb1.png" width="504" height="412" /></a> </p>
<h2>Step 2: Adding Tabs, Groups and Buttons</h2>
<p align="justify">As described earlier a ribbon control contains different tabs, each tab contains a groups and groups in turn contain buttons. In this step we would create tabs, groups and buttons.</p>
<p align="justify">1. To add tabs to your ribbon control add the r:RibbonTab tag within the r:Ribbon tag you added in the last step.</p>
<div>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonTab</span> <span style="color: #ff0000">Label</span><span style="color: #0000ff">=&quot;Home&quot;</span><span style="color: #0000ff">&gt;</span>

<span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonTab</span><span style="color: #0000ff">&gt;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonTab</span> <span style="color: #ff0000">Label</span><span style="color: #0000ff">=&quot;Insert&quot;</span><span style="color: #0000ff">&gt;</span>

<span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonTab</span><span style="color: #0000ff">&gt;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonTab</span> <span style="color: #ff0000">Label</span><span style="color: #0000ff">=&quot;Help&quot;</span><span style="color: #0000ff">&gt;</span>

<span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonTab</span><span style="color: #0000ff">&gt;</span></pre>
</div>
<div>Your application should look somewhat like this now. Note that the support for hovering and clicking has been added automatically.</div>
<div><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image_thumb2.png" width="504" height="475" /></a>&#160; </div>
<div>2. To add groups within a tab, place the r:RibbonGroup tag inside the r:RibbonTab tag.</div>
<div>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonGroup</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;Clipboard&quot;</span><span style="color: #0000ff">&gt;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonGroup</span><span style="color: #0000ff">&gt;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonGroup</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;Fonts&quot;</span><span style="color: #0000ff">&gt;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonGroup</span><span style="color: #0000ff">&gt;</span></pre>
</div>
<div>I am adding Clipboard and Fonts tabs within the Home tab. </div>
<div><strong>Note: If you run the application containing empty Ribbon Groups it would crash.</strong></div>
<div>3. Now to add buttons, place the r:RibbonButton tags inside the r:RibbonGroup tags you just created.</div>
<div>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonButton</span> <span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">r:RibbonButton</span><span style="color: #0000ff">&gt;</span></pre>
</div>
<div>Your code should not look like this;</div>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonWindow</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;FirstRibbonApplication.Window1&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #ff0000">xmlns:r</span><span style="color: #0000ff">=&quot;clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #ff0000">Title</span><span style="color: #0000ff">=&quot;Window1&quot;</span> <span style="color: #ff0000">Height</span><span style="color: #0000ff">=&quot;300&quot;</span> <span style="color: #ff0000">Width</span><span style="color: #0000ff">=&quot;300&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:Ribbon</span> <span style="color: #ff0000">Title</span><span style="color: #0000ff">=&quot;Window1&quot;</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;ribbon&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonTab</span> <span style="color: #ff0000">Label</span><span style="color: #0000ff">=&quot;Home&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonGroup</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;Clipboard&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                    <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonButton</span> <span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">r:RibbonButton</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonGroup</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonGroup</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;Fonts&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                    <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonButton</span> <span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">r:RibbonButton</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonGroup</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonTab</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonTab</span> <span style="color: #ff0000">Label</span><span style="color: #0000ff">=&quot;Insert&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonTab</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonTab</span> <span style="color: #ff0000">Label</span><span style="color: #0000ff">=&quot;Help&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonTab</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:Ribbon</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonWindow</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<div>Congratulations! You have successfully created tabs, groups and buttons in your ribbon control application.</div>
<div><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image_thumb3.png" width="504" height="402" /></a> </div>
<div>Note that the buttons are still blank. We will take care of this in Step 3.</div>
<h2>Step 3: Adding Commands to Ribbon Groups and Ribbon Buttons</h2>
<div>In this step we would define resources for our ribbon groups and ribbon buttons and define commands on them.</div>
<div>1. Create an Images folder and add some images to act as icons for your ribbon buttons. </div>
<div>2. Use the following XAML code to define a resource dictionay within the RibbonWindow tag. We would use this to define resources for our buttons.</div>
<div>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonWindow.Resources</span><span style="color: #0000ff">&gt;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">ResourceDictionary</span><span style="color: #0000ff">&gt;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">ResourceDictionary</span><span style="color: #0000ff">&gt;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonWindow.Resources</span><span style="color: #0000ff">&gt;</span></pre>
</div>
<div>3. Now add a resource for our Clipboard Ribbon Group. The code would look like this.</div>
<div>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonCommand</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;ClipboardGroupCommand&quot;</span><span style="color: #ff0000">CanExecute</span><span style="color: #0000ff">=&quot;OnCanExecute&quot;</span><span style="color: #ff0000">Executed</span><span style="color: #0000ff">=&quot;OnShowClipboardGroup&quot;</span><span style="color: #ff0000">LabelTitle</span><span style="color: #0000ff">=&quot;Clipboard&quot;</span><span style="color: #0000ff">/&gt;</span></pre>
</div>
<div><strong>x:Key</strong> is used to reference this element. </div>
<div><strong>CanExecute</strong> and <strong>Execute</strong> are holding names for events that would be fired. </div>
<div><strong>LabelTitle</strong> holds the title of the group we are creating this resource for.</div>
<div>4. Once the resource has been defined, let us use it for the Clipboard group. </div>
<div>Find this part in your XAML code;</div>
<div>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonGroup</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;Clipboard&quot;</span><span style="color: #0000ff">&gt;</span></pre>
</div>
<div>and replace it with </div>
<div id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonGroup</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;Clipboard&quot;</span> <span style="color: #ff0000">HasDialogLauncher</span><span style="color: #0000ff">=&quot;True&quot;</span> <span style="color: #ff0000">Command</span><span style="color: #0000ff">=&quot;{StaticResource ClipboardGroupCommand}&quot;</span><span style="color: #0000ff">&gt;</span></pre>
</div>
<p>Now, we have connected our resource with RibbonGroup. I have added HasDialogLauncher=”True” because that will allow us to fire OnShowClipboardGroup&#160; event when user clicks on dialog launcher.</p>
</p>
</p>
</p>
</p>
</p>
<p>5. Go to your CS code-behind file and add these lines:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> OnCanExecute(<span style="color: #0000ff">object</span> target, CanExecuteRoutedEventArgs args){args.CanExecute = <span style="color: #0000ff">true</span>;}

<span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> OnShowClipboardGroup(<span style="color: #0000ff">object</span> target, ExecutedRoutedEventArgs args){MessageBox.Show(<span style="color: #006080">&quot;This is the Clipboard!.&quot;</span>, <span style="color: #006080">&quot;Clipboard Dialog&quot;</span>);}</pre>
<p></div>
</p>
<p>In principal we are done with this step and the essential concepts have been learnt. You can now learn your application and test to see that the message box is displayed.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image7.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image_thumb6.png" width="504" height="404" /></a> </p>
</p>
<p>Similar to step 4 and 5 create another RibbonCommand, add the resource to the Copy Button and write the corresponding cs code.</p>
<p>Creating another RibbonCommand;</p>
<div id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonCommand</span><span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;CopyCommand&quot;</span><span style="color: #ff0000">CanExecute</span><span style="color: #0000ff">=&quot;OnCanExecute&quot;</span><span style="color: #ff0000">Executed</span><span style="color: #0000ff">=&quot;OnCopyCommand&quot;</span><span style="color: #ff0000">LabelTitle</span><span style="color: #0000ff">=&quot;Copy&quot;</span><span style="color: #ff0000">LargeImageSource</span><span style="color: #0000ff">=&quot;Images\copy.png&quot;</span><span style="color: #ff0000">ToolTipTitle</span><span style="color: #0000ff">=&quot;Copy (Ctrl+C)&quot;</span><span style="color: #ff0000">ToolTipDescription</span><span style="color: #0000ff">=&quot;Copies the selected content on to the clipboard&quot;</span><span style="color: #0000ff">&gt;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonCommand</span><span style="color: #0000ff">&gt;</span></pre>
<p>Adding the RibbonCommand to the RibbonButton;</p></div>
<div>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonButton</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;Copy&quot;</span> <span style="color: #ff0000">Command</span><span style="color: #0000ff">=&quot;{StaticResource CopyCommand}&quot;</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">r:RibbonButton</span><span style="color: #0000ff">&gt;</span></pre>
</div>
<div>Adding the event to the code-beside file;</div>
<div>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> OnCopyCommand(<span style="color: #0000ff">object</span> target, ExecutedRoutedEventArgs args){    MessageBox.Show(<span style="color: #006080">&quot;This is the copy button!.&quot;</span>, <span style="color: #006080">&quot;Copy Dialog&quot;</span>);}</pre>
</div>
<div>Your XAML code should look like this now;</div>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonWindow</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;FirstRibbonApplication.Window1&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #ff0000">xmlns:r</span><span style="color: #0000ff">=&quot;clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #ff0000">Title</span><span style="color: #0000ff">=&quot;Window1&quot;</span> <span style="color: #ff0000">Height</span><span style="color: #0000ff">=&quot;600&quot;</span> <span style="color: #ff0000">Width</span><span style="color: #0000ff">=&quot;400&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonWindow.Resources</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">ResourceDictionary</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonCommand</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;ClipboardGroupCommand&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                             <span style="color: #ff0000">CanExecute</span><span style="color: #0000ff">=&quot;OnCanExecute&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                             <span style="color: #ff0000">Executed</span><span style="color: #0000ff">=&quot;OnShowClipboardGroup&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                             <span style="color: #ff0000">LabelTitle</span><span style="color: #0000ff">=&quot;Clipboard&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonCommand</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonCommand</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;CopyCommand&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #ff0000">CanExecute</span><span style="color: #0000ff">=&quot;OnCanExecute&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #ff0000">Executed</span><span style="color: #0000ff">=&quot;OnCopyCommand&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #ff0000">LabelTitle</span><span style="color: #0000ff">=&quot;Copy&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #ff0000">LargeImageSource</span><span style="color: #0000ff">=&quot;Images\copy.png&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #ff0000">ToolTipTitle</span><span style="color: #0000ff">=&quot;Copy (Ctrl+C)&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #ff0000">ToolTipDescription</span><span style="color: #0000ff">=&quot;Copies the selected content on to the clipboard&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonCommand</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;/</span><span style="color: #800000">ResourceDictionary</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonWindow.Resources</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span>  <span style="color: #ff0000">HorizontalAlignment</span><span style="color: #0000ff">=&quot;Stretch&quot;</span> <span style="color: #ff0000">VerticalAlignment</span><span style="color: #0000ff">=&quot;Top&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:Ribbon</span> <span style="color: #ff0000">Title</span><span style="color: #0000ff">=&quot;Window1&quot;</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;ribbon&quot;</span>  <span style="color: #ff0000">VerticalAlignment</span><span style="color: #0000ff">=&quot;Top&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonTab</span> <span style="color: #ff0000">Label</span><span style="color: #0000ff">=&quot;Home&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonGroup</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;Clipboard&quot;</span> <span style="color: #ff0000">HasDialogLauncher</span><span style="color: #0000ff">=&quot;True&quot;</span> <span style="color: #ff0000">Command</span><span style="color: #0000ff">=&quot;{StaticResource ClipboardGroupCommand}&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                    <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonButton</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;Copy&quot;</span> <span style="color: #ff0000">Command</span><span style="color: #0000ff">=&quot;{StaticResource CopyCommand}&quot;</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">r:RibbonButton</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonGroup</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonGroup</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;Fonts&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                    <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonButton</span>  <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;Paste&quot;</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">r:RibbonButton</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonGroup</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonTab</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonTab</span> <span style="color: #ff0000">Label</span><span style="color: #0000ff">=&quot;Insert&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonTab</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;</span><span style="color: #800000">r:RibbonTab</span> <span style="color: #ff0000">Label</span><span style="color: #0000ff">=&quot;Help&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonTab</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:Ribbon</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">r:RibbonWindow</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<div>Now you should be able to see an icon on your Copy Button and an accompanying tooltip.</div>
<div>&#160;<a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image8.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2010/04/image_thumb7.png" width="504" height="404" /></a> </p>
<p></div>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2010/04/18/create-a-simple-wpf-ribbon-control-what-i-learnt-today/" target="_blank"><img src="http://tayyab.xenoglaux-solutions.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2010/04/18/create-a-simple-wpf-ribbon-control-what-i-learnt-today/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://tayyab.xenoglaux-solutions.com/2010/04/18/create-a-simple-wpf-ribbon-control-what-i-learnt-today/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Generating Documentation from XML Comments in C#</title>
		<link>http://tayyab.xenoglaux-solutions.com/2009/06/04/generating-documentation-from-xml-comments-in-c/</link>
		<comments>http://tayyab.xenoglaux-solutions.com/2009/06/04/generating-documentation-from-xml-comments-in-c/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 18:28:35 +0000</pubDate>
		<dc:creator>tayyabtariq</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Visual Studion .NET]]></category>
		<category><![CDATA[Comments]]></category>
		<category><![CDATA[Generate Documentation]]></category>
		<category><![CDATA[Visual Studio.NET]]></category>
		<category><![CDATA[XML Comments]]></category>

		<guid isPermaLink="false">http://tayyab.xenoglaux-solutions.com/2009/06/04/generating-documentation-from-xml-comments-in-c/</guid>
		<description><![CDATA[C# allows developers to embed XML comments into their source files—a useful facility, especially when more than one programmer is working on the same code. The C# parser can expand these XML tags to provide additional information and export them to an external document for further processing. This article shows how to use XML comments [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">C# allows developers to embed XML comments into their source files—a useful facility, especially when more than one programmer is working on the same code. The C# parser can expand these XML tags to provide additional information and export them to an external document for further processing. This article shows how to use XML comments and explains the relevant tags. The author demonstrates how to set up your project to export your XML comments into convenient documentation for the benefit of other developers. He also shows how to use comments to generate help files using <a href="http://sourceforge.net/project/showfiles.php?group_id=36057" target="_blank">nDoc</a>.</p>
<div align="justify"><span id="more-107"></span></div>
<p align="justify">Wouldn&#8217;t it be nice if all this information were kept in one location? The obvious place to put this information is in the source code itself; this makes it easy to modify the docs along with the code. But it is hard enough to go through someone else&#8217;s program when you know how to code, let alone when you are less technically savvy. Also, adding code documentation takes time.   <br />This article will show you how to solve many of those problems using XML comments. Code comments, user manuals, developer manuals, test plans, and many other documents can be generated from a single source using XML tags. I&#8217;ll explain how to insert XML comments and enable exportation of these comments to another file. I&#8217;ll then discuss each of the available tags and the format of the XML file where the tags are used and walk through an example of using XML comments and XSLT to generate help files.</p>
<h2>XML Comments</h2>
<p>All XML comments begin with three forward slashes (///). The first two slashes signify a comment and tell the compiler to ignore the text that follows. The third slash tells the parser that this is an XML comment and should be handled appropriately.   <br />&#160;&#160;&#160;&#160;&#160; When the developer types the three forward slashes, the Microsoft® Visual Studio® .NET IDE checks to see if it precedes an identifiable type or type member definition. If it is identifiable, then the Visual Studio .NET IDE will automatically insert a few comment tags. The developer then adds additional tags and values as needed. For example, here are the XML tags that are generated when the three forward slashes are entered before this member function that has a parameter:</p>
<div>
<pre><code>/// &lt;summary&gt;
///
/// &lt;/summary&gt;
/// &lt;param name=&quot;strFilePath&quot;&gt;&lt;/param&gt;
public void LoadXMLFromFile(string strFilePath)
</code></pre>
</div>
<p align="justify">The tags inserted here represent only a couple of many that the Visual Studio .NET IDE already knows.</p>
<p align="justify">While the current implementation of IntelliSense® for XML comments does not show all the tags listed in the C# specification, the missing tags can always be inserted manually.<br />
  <br />&#160;&#160;&#160;&#160;&#160; Once comments are inserted, it would be useful to do something with them. If you set things up correctly (as I&#8217;ll explain shortly), this usually just means exporting all the text that comes after the three forward slashes into an external file.</p>
<p>&#160;&#160;&#160;&#160;&#160; There are also several predefined XML comment tags that the parser knows. When these tags are encountered (and have been used correctly by the developer), the parser will format the tags&#8217; output to a text file. If a tag that is not predefined is encountered, it is just written verbatim along with any text to the external file. This means that you can make up your own tags or you can even use known tags recognizable from another source (such as HTML) in the comments.</p>
<p>&#160;&#160;&#160;&#160;&#160; When exportation is set up correctly, the C# parser extracts the XML comments, does formatting if needed, and places them into an XML file of your choice. You can set the location and file name of the XML document file, and enable exportation, through your project&#8217;s property pages. To do this, follow these four steps:</p>
<ul>
<li>
<div align="justify">Open the property page for the project, usually by right-clicking on the project in the Solution Explorer, and click Properties.</div>
</li>
<li>
<div align="justify">After the dialog has opened, click the Configuration Properties folder.</div>
</li>
<li>
<div align="justify">Click the Build option.</div>
</li>
<li>
<div align="justify">In the right pane, there will be a property field called XML Documentation File. Set this to the path and file name of the desired file. The path entered is relative to the project directory, not absolute.</div>
</li>
</ul>
<h2>Recognized Tags</h2>
<p align="justify">I have classified the XML comment tags into two categories. The first set of tags, which I&#8217;ll call primary tags, always starts a group of XML comment tags. They are never embedded within other tags. The second set contains tags that are used within primary tags as modifiers to the text. I call them support tags. </p>
<p>here are nine primary tags: &lt;remarks&gt;, &lt;summary&gt;, &lt;example&gt;, &lt;exception&gt;, &lt;param&gt;, &lt;permission&gt;, &lt;returns&gt;, &lt;seealso&gt;, and &lt;include&gt;.<br />
  <br />&#160;&#160;&#160;&#160;&#160; In this context, the &lt;remarks&gt; tag is used to describe a type such as a class: </p>
<div align="justify">
<pre><code>/// &lt;remarks&gt;
/// Class that contains functions to do
/// transformations to help files.
/// &lt;/remarks&gt;
</code></pre>
</div>
<p>&#160;</p>
<p>The C# documentation recommends using &lt;remarks&gt; to describe a type and a &lt;summary&gt; tag to describe a type member.Oddly, if you start a comment before a type using the /// combination, the Visual Studio .NET IDE will still insert a &lt;summary&gt; tag. Therefore, &lt;remarks&gt; tags need to be inserted manually.<br />
  <br />The &lt;summary&gt; tag is the tag found most often in a C# source file. This tag is used to describe type members, including methods, properties, and fields:</p>
<div align="justify">
<pre><code>/// &lt;summary&gt;
/// This XmlDocument based attribute contains the
/// XML documentation for the project.
/// &lt;/summary&gt;
</code></pre>
</div>
<p align="justify">&#160;</p>
<p align="justify">The &lt;summary&gt; tag can describe types as well, but it is not recommended. The XML comment documentation recommends that the &lt;remarks&gt; tag be used for describing types.<br />
  <br />The &lt;example&gt; tag is used to mark the beginning of an example showing how to use the item. The example can be any valid text, but most often it is a snippet of code:</p>
<div align="justify">
<pre><code>/// &lt;example&gt;
/// &lt;code&gt;
/// // create the class that does translations
/// GiveHelpTransforms ght = new GiveHelpTransforms();
/// // have it load our XML into the SourceXML property
/// ght.LoadXMLFromFile(
///  &quot;E:\\Inetpub\\wwwroot\\GiveHelp\\GiveHelpDoc.xml&quot;);
/// &lt;/code&gt;
/// &lt;/example&gt;
</code></pre>
</div>
<p align="justify">&#160;</p>
<p align="justify">If code is used, it is usually marked with a &lt;code&gt; tag. The &lt;code&gt; tag will be discussed in the section on support tags.<br />
  <br />The &lt;exception&gt; tag documents the exceptions, if any, that the item may throw. If more than one exception may be thrown, then more than one of these tags may be used. Unlike most of the tags, the &lt;exception&gt; tag has one attribute, cref. The value of this attribute is the name of the exception that could be thrown. This must be a valid class because the C# parser will verify it and extract the context information to put into the XML documentation. I will explain this later.</p>
<p>I did not throw any exceptions in the code for this article, but here is an example of how the cref attribute can be used with the &lt;exception&gt; tag:</p>
<div align="justify">
<pre><code>/// &lt;exception cref=&quot;SampleException&quot;&gt;
/// Normally, a discussion on any exceptions thrown would go here.
/// &lt;/exception&gt;
</code></pre>
</div>
<p align="justify">&#160;</p>
<p align="justify">The &lt;param&gt; tag describes the parameters of a method or property. It is automatically inserted by the IDE when using the three forward slashes before a method. The &lt;param&gt; tag has one attribute, name, which is simply the same name that the parameter has in the source:</p>
<div align="justify">
<pre><code>/// &lt;param name=&quot;strFilePath&quot;&gt;The path to the file containing the
/// source XML.&lt;/param&gt;
</code></pre>
</div>
<p align="justify">&#160;</p>
<p align="justify">Member access is identified with the &lt;permission&gt; tag. The text that is assigned to it sets permission-related descriptions. There is no requirement for the value for this tag. Permission is one possibility, with values such as public, private, protected, and so on. Scope is another possible value, with information about whether the method is static. However, you are free to put whatever value you must have here.<br />
  <br />The &lt;permission&gt; tag has one attribute—cref. The documentation describes the use of cref in this context as &quot;a reference to a member or field that is available to be called from the current compilation environment.&quot; It is usually set to System.Security.PermissionSet:</p>
<div align="justify">
<pre><code>/// &lt;permission cref=&quot;System.Security.PermissionSet&quot;&gt;Public
/// Access&lt;/permission&gt;
</code></pre>
</div>
<p align="justify">&#160;</p>
<p align="justify">The &lt;returns&gt; tag is similar to the &lt;param&gt; tag, but it&#8217;s used to describe what the method or property returns:</p>
<div align="justify">
<pre><code>/// &lt;returns&gt;The HTML for a list of types based on the XML
/// documentation.&lt;/returns&gt;
</code></pre>
</div>
<p align="justify">&#160;</p>
<p align="justify">The &lt;seealso&gt; tag specifies &quot;other&quot; links related to the same topic. This tag usually does not include a text value, just a cref attribute that specifies a reference to a symbol. This could be a type, member, field, and so on.</p>
<div align="justify">
<pre><code>/// &lt;seealso cref=&quot;GiveMemberListHTMLHelp&quot;/&gt;
</code></pre>
</div>
<p align="justify">&#160;</p>
<p align="justify">The XML compiler will identify the content of the symbol and use it accordingly in the compiled XML documentation. I&#8217;ll discuss this again in the section on the XML documentation file.<br />
  <br />When XML comments are extracted from the code by the compiler, any file specified in the &lt;include&gt; tag will be expanded and the comments inside it will be used as if that had been included inline. Because the compiler finds them, you can keep comments in an external file. This can help organize your code, but then the comments are not readily available. I would never use the &lt;include&gt; tag for this reason, but if your comments are lengthy, you may find the trade-off acceptable.</p>
<p>&#160;&#160;&#160;&#160;&#160; Several attributes must accompany the &lt;include&gt; tag to specify the external file. The file attribute is the name of the file using relative or fully qualified paths. The include file itself is an XML document that holds XML comments. The path attribute is an XPath statement that points to the parent element of the XML comments in the external document, as you can see here:</p>
<div align="justify">
<pre><code>/// &lt;include file='MyXMLCommentFile.xml'
/// path='doc/members/member[@name=&quot;T:MyExampleClass&quot;]/*'/&gt;
public class MyExampleClass
{
/// &lt;include file='MyXMLCommentFile.xml'
   /// path='doc/members/member[@name=&quot;M:MyExampleMethod&quot;]/*'/&gt;
   public string MyExampleMethod(string strReturnThis)
   {
     return strReturnThis;
   }
}
</code></pre>
</div>
<h2>Support Tags</h2>
<p align="justify">&#160;&#160;&#160;&#160;&#160; There are eleven support tags: &lt;c&gt;, &lt;code&gt;, &lt;list&gt;, &lt;listheader&gt;, &lt;item&gt;, &lt;term&gt;, &lt;description&gt;, &lt;para&gt;, &lt;paramref&gt;, &lt;see&gt;, and &lt;value&gt;.<br />
  <br />&#160;&#160;&#160;&#160;&#160; The &lt;c&gt; tag marks a line of text as code. It is usually used inline in descriptive text.</p>
<div align="justify">
<pre><code>/// The source XML is loaded into the &lt;see cref=&quot;SourceXML&quot;/&gt;
/// property (e.g. &lt;c&gt;&lt;I&gt;obj&lt;/I&gt;.SourceXML =
/// &quot;&lt;I&gt;XML goes here&lt;/I&gt;&quot;&lt;/c&gt;).
</code></pre>
</div>
<p align="justify">&#160;</p>
<p align="justify">The &lt;code&gt; tag also defines a section of text as code. It is often used within an &lt;example&gt; tag block (as shown earlier). The &lt;code&gt; tag is similar to the &lt;c&gt; tag, but &lt;c&gt; is used for a single line of code while &lt;code&gt; is used for a block of code. It specifies that the formatting of the text in the comments needs to remain the same:</p>
<div align="justify">
<pre><code>/// &lt;code&gt;
/// // create the class that does translations
/// GiveHelpTransforms ght = new GiveHelpTransforms();
/// // have it load our XML into the SourceXML property
/// ght.LoadXMLFromFile(
///      &quot;E:\\Inetpub\\wwwroot\\GiveHelp\\GiveHelpDoc.xml&quot;);
/// &lt;/code&gt;
</code></pre>
</div>
<p align="justify">&#160;</p>
<p align="justify">The &lt;list&gt; tag is used in other comment tags to define a specialized list. The type of list is defined by the type attribute, which can have the values bullet, number, or table. Within the &lt;list&gt; tag, there are tags that denote the components of the list, as you can see in this example:</p>
<div align="justify">
<pre><code>/// &lt;list type=&quot;table&quot;&gt;
/// &lt;listheader&gt;
/// &lt;term&gt;Help Page&lt;/term&gt;
/// &lt;description&gt;Function to call&lt;/description&gt;
/// &lt;/listheader&gt;
/// &lt;item&gt;&lt;term&gt;List of Types&lt;/term&gt;
/// &lt;description&gt;GiveTypeListHTMLHelp&lt;/description&gt;&lt;/item&gt;
/// &lt;item&gt;&lt;term&gt;List of members&lt;/term&gt;
/// &lt;description&gt;GiveMemberListHTMLHelp&lt;/description&gt;&lt;/item&gt;
/// &lt;item&gt;&lt;term&gt;Help for a single member&lt;/term&gt;
/// &lt;description&gt;GiveMemberHTMLHelp&lt;/description&gt;&lt;/item&gt;
/// &lt;/list&gt;
</code></pre>
</div>
<p align="justify">&#160;</p>
<p align="justify">The &lt;listheader&gt; tag holds header information for the list (see the previous example). It is typically used for a table of list types.<br />
  <br />As you probably guessed, the &lt;item&gt; tag identifies each item in the list. It can stand alone or wrap &lt;term&gt; and &lt;description&gt; tags. The &lt;term&gt; and &lt;description&gt; tags are always children tags of the &lt;listheader&gt; tag or &lt;item&gt; tags. They are always used in pairs and their function is obvious.</p>
<p>The &lt;para&gt; tag is used to identify a new paragraph. It is very similar to the &lt;P&gt; tag in HTML. You should definitely use this tag to break up long comment sections:</p>
<div align="justify">
<pre><code>/// &lt;summary&gt;This is a summary.
/// &lt;para&gt;This is a new paragraph.&lt;/para&gt;
/// &lt;/summary&gt;
</code></pre>
</div>
<p align="justify">&#160;</p>
<p align="justify">If text within a comment needs to have a parameter specially identified, then &lt;paramref&gt; is the tag to use. It is inserted in the text in the location where the parameter text should appear. The main purpose of this tag is to identify the name of a parameter that should be formatted in a special way. It has one attribute, name, which is the name of the parameter that would appear in the text, usually formatted in a special way:</p>
<div align="justify">
<pre><code>/// Loads the XML documentation in the file specified by
/// &lt;paramref&gt;strFilePath&lt;/paramref&gt;.
</code></pre>
</div>
<p align="justify">&#160;</p>
<p align="justify">The &lt;see&gt; tag is used within the text of other comment tags to specify a hyperlink. It is used inline as part of the text and usually just includes one attribute, cref:</p>
<div align="justify">
<pre><code>/// One of the associated member functions (&lt;see
/// cref=&quot;GiveTypeListHTMLHelp&quot;/&gt;,
/// &lt;see cref=&quot;GiveMemberListHTMLHelp&quot;/&gt;, &lt;see
/// cref=&quot;GiveMemberHTMLHelp&quot;/&gt;)
/// is called to initiate and then return the transformation.
</code></pre>
</div>
<p align="justify">&#160;</p>
<p align="justify">The cref attribute specifies a reference to an existing symbol. See the description for the &lt;exception&gt; tag for more information.<br />
  <br />The &lt;value&gt; tag defines the meaning of a property member. It is used just like the &lt;remarks&gt; tag is used for classes and the &lt;summary&gt; tag is used for other members.</p>
<div align="justify">
<pre><code>/// &lt;value&gt;
/// The SourceXML property contains the XML that will be used in
/// the transformations by the member functions for this class.
/// &lt;/value&gt;</code></pre>
</div>
<div align="justify">
<pre><code></code></pre>
</div>
<h2 align="justify"><code><font face="Lucida Sans Unicode">Generating Documentation</font></code></h2>
<p align="justify"><code></code></p>
<p align="justify"><code></code></p>
<div align="right">
<pre><code><font face="Lucida Sans Unicode">Now that you have successfully created an XML file from the comments you need to generate documentation from it. For this purpose you can download and use </font><a href="http://sourceforge.net/project/showfiles.php?group_id=36057" target="_blank"><font face="Lucida Sans Unicode">nDoc</font></a><font face="Lucida Sans Unicode">.</font></code></pre>
</div>
<div align="right">
<pre><code><font face="Lucida Sans Unicode">Once you have downloaded nDoc, you can use its GUI interface to select a binary from your project directory (make sure it is in the debug folder and the .XML is located next to it).</font></code></pre>
</div>
<div align="right">
<pre><code><font face="Lucida Sans Unicode">nDoc allows you to create different types of documentations from simple HTML to MSDN style.</font></code></pre>
</div>
<div align="right">
<pre><code><font face="Lucida Sans Unicode"></font></code></pre>
</div>
<div align="right">
<pre><code><font face="Lucida Sans Unicode">If you need anymore help, please feel free to ask.</font></code></pre>
</div>
<div align="right">
<pre><code><font face="Lucida Sans Unicode">Related Article;</font></code></pre>
</div>
<div align="right">
<pre><a title="http://msdn.microsoft.com/en-us/magazine/cc302121.aspx" href="http://msdn.microsoft.com/en-us/magazine/cc302121.aspx"><font face="Lucida Sans Unicode">http://msdn.microsoft.com/en-us/magazine/cc302121.aspx</font></a></pre>
</div>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2009/06/04/generating-documentation-from-xml-comments-in-c/" target="_blank"><img src="http://tayyab.xenoglaux-solutions.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2009/06/04/generating-documentation-from-xml-comments-in-c/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://tayyab.xenoglaux-solutions.com/2009/06/04/generating-documentation-from-xml-comments-in-c/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Writing Unified Scalable Application Logic: Windows Workflow Foundation</title>
		<link>http://tayyab.xenoglaux-solutions.com/2009/05/24/writing-unified-scalable-application-logic-windows-workflow-foundation/</link>
		<comments>http://tayyab.xenoglaux-solutions.com/2009/05/24/writing-unified-scalable-application-logic-windows-workflow-foundation/#comments</comments>
		<pubDate>Sat, 23 May 2009 19:55:31 +0000</pubDate>
		<dc:creator>tayyabtariq</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Workflow Foundation]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Scalable Application Logic]]></category>
		<category><![CDATA[Scalable Applications]]></category>
		<category><![CDATA[Unified Application Logic]]></category>
		<category><![CDATA[Unified Logic]]></category>
		<category><![CDATA[Unified Scalable]]></category>
		<category><![CDATA[Visual Studio.NET]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Windows Workflow Foundation]]></category>

		<guid isPermaLink="false">http://tayyab.xenoglaux-solutions.com/2009/05/24/writing-unified-scalable-application-logic-windows-workflow-foundation/</guid>
		<description><![CDATA[Everyone who writes applications or creates software wants to create scalable and easy to understand solutions. The problem however is that simple software is not scalable and scalable applications can get too hard to understand because of their distributed logic development. 
 
A simple application may be implemented as shown in the following figure.
 
Figure [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone who writes applications or creates software wants to create scalable and easy to understand solutions. The problem however is that simple software is not scalable and scalable applications can get too hard to understand because of their distributed logic development. </p>
<p> <span id="more-99"></span>
<p>A simple application may be implemented as shown in the following figure.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image3.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="363" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image-thumb3.png" width="644" border="0" /></a> </p>
<p><strong>Figure 1: Simple unified logic that runs in a single process and thread (Courtesy MSDN).</strong></p>
<p>The above pseudo-code takes input from the client and based on the input executed different paths. Note that the input is taken at different points in the code. The state of the application/process is represented here by a simple string. Although this application development style is simple and easy to understand, it is not scalable. Imagine you are using such application logic for a hiring process where the inputs can come after days and even weeks. Your server would have to keep the process alive and running for this whole period. Imagine how much resources it would take to cater for thousands of users. What if the server fails during this period?</p>
<p>Considering these problems, lets look at another solution. This time round we separate the application logic at the freezing points (the input). Breaking the application logic allows the application to run as two different threads. This can solve a few of the problems described above.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image4.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="368" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image-thumb4.png" width="644" border="0" /></a> </p>
<p><strong>Figure 2: Breaking the application logic (Courtesy MSDN).</strong></p>
<p>Note that this time round the state is stored outside of the process in a database. The reason is that whenever the second process starts it needs to get the current state from some “persistent” store. Also note that the two application parts can now run on two different machines. Can you see a problem with this? The problem comes from the fact that it is hard for the second process to know whether the if was executed in the first part or the else (of course you would have to make this a part of the state). The point here is that the state becomes complex and we have to introduce a number of checks in the second part of the application. </p>
<p>The first figure is how our usual desktop applications run. they have their state stored in some memory variables that vanish as soon as the application ends. The applications which remember what you did last time have to save this state in some persistent storage. The second example is how ASP.NET applications work. The application logic is implemented in a distributed manner (on different pages). This not only makes it difficult for people to understand the process but also the programmer has to perform a series of checks whenever a page loads. It is also to be noted that the first type provides us unified logic whereas the second provides us scalability. </p>
<h2>The Solution</h2>
<p>Using windows workflows can help us solve these problems. WF function just as a normal program providing mechanism for input, output, control flow etc. However, all these are done with the help of activities, see diagram below.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image5.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="484" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image-thumb5.png" width="552" border="0" /></a> </p>
<p><strong>Figure 3: In a workflow all the things are done with the help of activities (Courtesy MSDN)</strong></p>
<p>As you can probably already see that unified logic is provided by workflows, let us see how WF solve the problem of scalability. All the work in the WF is done using activates, and as seen the WF provides all the elements of a usual programming language. The difference however is that all these activities are classes themselves, and they are executed on a WF Runtime which knows how to run these classes (activities).</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image6.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="484" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image-thumb6.png" width="545" border="0" /></a> </p>
<p><strong>Figure 3: WF Runtime executes activities in order (Courtesy MSDN).</strong></p>
<p>When it begins the workflow runtime executes the outer most activity first, which in this case is a sequential workflow. Then it executes the activities one after the other in order determined by the workflow. One thing to note here is that the activities are objects, and therefore can be described in any language, making the workflow independent of the language. Also that the WF Runtime does not know anything about the internals of the activity it is executing, allow the programmer to fill in what is to be done. WF provides a Base Activity Library (BAL) from which you can pick activities to include in your workflow. You can also create activates of your own, called custom activities. </p>
<p>The big question arises, why go through all this pain? The first answer to this question has already been answered, it provides unified logic. However, to be scalable the server application cannot be stuck with one process. One solution to this is the ASP.NET way, i.a. to break the application logic down into small chunks, however this is something we are trying to avoid. Moreover, the programmer than has to explicitly deal with state. As you can probably notice this WF is already broken down into chunks, this allows the WF to persist (not block waiting for an event). When at the start of our example workflow, the workflow is waiting for input the WF Runtime realizes this and stores the state of the WF in a persistent storage (we say the WF persists). This allows for the server resources to be used elsewhere. When the input arrives the WF Runtime wakes up the WF.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image7.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="452" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image-thumb7.png" width="644" border="0" /></a> <strong>Figure 5: The workflow can persist (Courtesy MSDN).</strong></p>
<p>Another advantage of the workflow being broken down from the perspective of scalability is the ability of the WF to be run on different machines when it resumes, as shown in the following diagram.</p>
<p>&#160;<a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image8.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="434" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image-thumb8.png" width="644" border="0" /></a> </p>
<p><strong>Figure 6 Different parts of a workflow can run on different machines</strong></p>
<h3>Other Benefits</h3>
<p>Other benefits of using windows workflows include the following</p>
<h4>Coordinating Parallel Work</h4>
<p>The WF allows you to coordinate parallel work in a better way by using the parallel activity which is part of BAL (More on this in later articles).</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image9.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="482" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image-thumb9.png" width="644" border="0" /></a> </p>
<p><strong>Figure 7 Workflows can run parallel activates (Courtesy MSDN).</strong></p>
<h4>Providing Tracking</h4>
<p>Tracking processes is an important part of any business application. WF makes it extremely easy to do this by providing tracking services. The tracking services are extremely closely linked to persistence (state maintenance) because the state of the WF has all the information one needs for tracking a WF.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image10.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="484" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image-thumb10.png" width="577" border="0" /></a>&#160; </p>
<p><strong>Figure 8 You can track the WF using tracking services (Courtesy MSDN).</strong></p>
<h4>Creating custom activities</h4>
<p>WF allows you to create custom activities that you can re use as is suited to your business application, allowing to use OO concepts in WF.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image11.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="484" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image-thumb11.png" width="250" border="0" /></a> </p>
<p><strong>Figure 9 You can create custom activities (Courtesy MSDN).</strong></p>
<h4>Fully Declarative Language</h4>
<p>WFs are fully declarative as each workflow is represented by a corresponding XAML file.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image12.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="475" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/05/image-thumb12.png" width="582" border="0" /></a> </p>
<p><strong>Figure 10 WFs are fully declarative (Courtesy MSDN).</strong></p>
<p>&#160;</p>
<h4>Related articles</h4>
<p><a title="http://msdn.microsoft.com/en-us/library/dd851337.aspx" href="http://msdn.microsoft.com/en-us/library/dd851337.aspx">http://msdn.microsoft.com/en-us/library/dd851337.aspx</a></p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2009/05/24/writing-unified-scalable-application-logic-windows-workflow-foundation/" target="_blank"><img src="http://tayyab.xenoglaux-solutions.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2009/05/24/writing-unified-scalable-application-logic-windows-workflow-foundation/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://tayyab.xenoglaux-solutions.com/2009/05/24/writing-unified-scalable-application-logic-windows-workflow-foundation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Forms: Getting Started II</title>
		<link>http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-ii/</link>
		<comments>http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-ii/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 18:13:55 +0000</pubDate>
		<dc:creator>tayyabtariq</dc:creator>
				<category><![CDATA[Windows Forms]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[EventHandling]]></category>
		<category><![CDATA[MessageBox]]></category>
		<category><![CDATA[PushButton]]></category>
		<category><![CDATA[TextBox]]></category>
		<category><![CDATA[User Input]]></category>

		<guid isPermaLink="false">http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-ii/</guid>
		<description><![CDATA[This tutorial contains some basic topics regarding getting started with&#160; windows forms.
 
Handling User Input
This topic describes how you can take input from a user on a windows form and use that input.
Once you have created a Windows Forms Application, add a textbox control to the windows form. You can do this by dragging the [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial contains some basic topics regarding getting started with&#160; windows forms.</p>
<p> <span id="more-54"></span><br />
<h2>Handling User Input</h2>
<p>This topic describes how you can take input from a user on a windows form and use that input.</p>
<p>Once you have <a href="http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-i/" target="_blank">created a Windows Forms Application</a>, add a textbox control to the windows form. You can do this by dragging the control from the toolbox to the windows form and place it wherever you may please. It is always a good idea to place a label (static text box) next to a text box that describes what the text box takes as an input. You can also place this static text control in the same manner. Also add a push button below the two controls.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/04/image8.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="364" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/04/image-thumb8.png" width="644" border="0" /></a> </p>
<p>You can change the text on a control and its identifier (ID) by editing its properties. To do this right click on a control and click properties. The properties panel opens up. The two main properties we will be concerned with are Text and ID. It is highly recommended that you play around with the other properties as well.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/04/image9.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="379" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/04/image-thumb9.png" width="644" border="0" /></a> </p>
<p>I have changed the ID of the textbox to textboxMessage. The ID of the other two controls has not been changed.</p>
<p>Now what we need to do is to create a create a EventHandler for the pushbotton. A EventHandler is a function when an Event occurs. You will become familiar with events as we move further in this tutorial. E.g. the click on a button is an event.</p>
<p>To create an even handler, click on a control and click on the lightning button on the properties panel.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/04/image10.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="379" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/04/image-thumb10.png" width="644" border="0" /></a> </p>
<p>In the push button events, click on the ‘Click’ event. This will create an EventHandler (a function) which is called when the button is pressed.</p>
<p>Once you double click on the event, you would be taken to the code of the event handler. In the event handler function add the following line.</p>
<p>MessageBox::Show(this-&gt;textBoxMessage-&gt;Text);</p>
<p>Your code should now look like this</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 115.01%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 102px; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">private</span>: System::Void button1_Click(System::Object *  sender, System::EventArgs *  e)</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum2" style="color: #606060">   2:</span>          {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum3" style="color: #606060">   3:</span>              MessageBox::Show(<span style="color: #0000ff">this</span>-&gt;textBoxMessage-&gt;Text);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum4" style="color: #606060">   4:</span>          }</pre>
<p><!--CRLF--></div>
</div>
<p>The MessageBox is a build in class with a static function Show. This function shows a message box with the given String. We get this string from the textbox we have created.</p>
<p>To get this string we first access the textBoxMessage control from the form class using the this pointer. Once we do this, we then use –&gt; to access its properties. One of these properties is the Text. Again i would recommend that you play around with these properties. </p>
<p>Now compile and run the project, it should do something like this.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/04/image11.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="379" alt="image" src="http://tayyab.xenoglaux-solutions.com/wp-content/uploads/2009/04/image-thumb11.png" width="644" border="0" /></a></p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-ii/" target="_blank"><img src="http://tayyab.xenoglaux-solutions.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-ii/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Forms: Getting Started I</title>
		<link>http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-i/</link>
		<comments>http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-i/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 17:38:29 +0000</pubDate>
		<dc:creator>tayyabtariq</dc:creator>
				<category><![CDATA[Windows Forms]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Visual Studio.NET]]></category>

		<guid isPermaLink="false">http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-i/</guid>
		<description><![CDATA[This tutorial contains some basic topics regarding getting started with&#160; windows forms.
All the data is courtesy MSDN.
 
Creating a Windows Forms Project
The foundation of most solutions that involve Windows Forms is the Windows Application project. Creating a project is easy within the integrated development environment (IDE).
To create a Windows Application project


On the File menu, point [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial contains some basic topics regarding getting started with&#160; windows forms.</p>
<p>All the data is courtesy <a href="msdn.com" target="_blank">MSDN</a>.</p>
<p> <span id="more-44"></span><br />
<h2>Creating a Windows Forms Project</h2>
<p>The foundation of most solutions that involve Windows Forms is the Windows Application project. Creating a project is easy within the integrated development environment (IDE).</p>
<h5>To create a Windows Application project</h5>
<ol>
<li>
<p>On the <b>File</b> menu, point to <b>New</b>, and then select <b>Project</b>.</p>
</li>
<li>
<p>In the <b>Project Types</b> pane, choose the programming language you want to use.</p>
</li>
<li>
<p>In the <b>Templates</b> pane, choose <b>Windows Application</b> for Visual Basic, Visual J#, or Visual C# projects, or choose <b>Windows Forms Application (.NET)</b> for Visual C++ projects. We will mostly concern ourselves with C++.</p>
<p>The Windows Forms Designer opens, showing Form1 of the project you created. </p>
</li>
</ol>
<h2>Display Windows Forms in the Designer </h2>
<p>Within the Windows Forms Designer, you can view the forms within your project and their controls.</p>
<h5>To view forms in the Windows Forms Designer</h5>
<ul>
<li>
<p>In <b>Solution Explorer</b>, double-click the form. For details, see <a href="http://msdn.microsoft.com/en-us/library/8bxxy49h%28VS.80%29.aspx">Windows Forms Overview</a>. </p>
<p>If <b>Solution Explorer</b> is not visible, select it from the <b>View</b> menu or press CTRL+W, S.</p>
</li>
</ul>
<h5>To view the code for a form</h5>
<ul>
<li>
<p>In <b>Solution Explorer</b>, select the form and then click the <b>View Code</b> button. You can also right-click the form in <b>Solution Explorer</b> and choose the <b>View Code</b> item in the shortcut menu. </p>
</li>
</ul>
<p>If the designer has focus, press F7 to switch to the <b>Code Editor</b>.</p>
<p><a href="http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-ii/" target="_blank">Next</a></p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-i/" target="_blank"><img src="http://tayyab.xenoglaux-solutions.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-i/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://tayyab.xenoglaux-solutions.com/2009/04/29/windows-forms-getting-started-i/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

