<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>CanOz Blog</title><link>http://blogs.vbcity.com/canoz/</link><description>Neil Knobbe's Blog at vbCity</description><managingEditor>V. Neil Knobbe</managingEditor><dc:language>en-AU</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>V. Neil Knobbe</dc:creator><title>Blog moved</title><link>http://blogs.vbcity.com/canoz/archive/2009/04/11/9291.aspx</link><pubDate>Sat, 11 Apr 2009 02:01:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2009/04/11/9291.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9291.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2009/04/11/9291.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9291.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9291.aspx</trackback:ping><description>&lt;P&gt;My blog has moved to it's new address.&lt;/P&gt;
&lt;P&gt;You can find my new blog &lt;A href="http://cs.vbcity.com/blogs/canoz/default.aspx"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9291.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>WPF project for Background Colours</title><link>http://blogs.vbcity.com/canoz/archive/2008/10/25/9195.aspx</link><pubDate>Sat, 25 Oct 2008 22:49:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/10/25/9195.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9195.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/10/25/9195.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9195.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9195.aspx</trackback:ping><description>&lt;P&gt;It is a little longer than I expected to get the the project that goes along with &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/07/16/9136.aspx" target=blank&gt;this post&lt;/A&gt; about background colours in WPF but as they say better late ....&lt;/P&gt;
&lt;P&gt;The project can be downloaded from &lt;A href="http://www.neilknobbe.com/projects/BackgroundColours.zip" target=blank&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9195.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>The Ampersand and XAML</title><link>http://blogs.vbcity.com/canoz/archive/2008/10/25/9193.aspx</link><pubDate>Sat, 25 Oct 2008 22:11:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/10/25/9193.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9193.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/10/25/9193.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9193.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9193.aspx</trackback:ping><description>&lt;P&gt;I got caught the other day with a "what the heck" moment.&lt;/P&gt;
&lt;P&gt;I was trying to display "Mr &amp;amp; Mrs" as an Item in a ComboBox but it just was not happening.&lt;/P&gt;
&lt;P&gt;I suppose that this would not have come to light if my computer was not slowing down when I opened the ItemCollection window in Visual Studio.&amp;nbsp; It was so slow that I would type something then have to wait for a couple of seconds to show what I had typed.&amp;nbsp; If I made a mistake I had to change it which would take more time, so I decided to just add the five combobox items in the XMAL itself.&lt;/P&gt;
&lt;P&gt;As soon as I typed the item in, I got the squiggly blue line and the following error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/001ampersand.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which really threw me.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Being an old HTML boy from years past it finally hit me.&amp;nbsp; XAML is a markup language and most, if not all, markup languages use the ampersand (&amp;amp;) for defining special characters and XML (which XAML is based on) is no different.&lt;/P&gt;
&lt;P&gt;XAML has the same &lt;A href="http://msdn.microsoft.com/en-us/library/ms748250.aspx" target=_blank&gt;character entities&lt;/A&gt;&amp;nbsp;as XML and one of these is for using the ampersand in markup.&lt;/P&gt;
&lt;P&gt;Having refreshed my memory getting the desired result was an easy fix.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02ampersand.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which, when run, shows correctly in the ComboBox.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03ampersand.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9193.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Printing a Windows Foundation Presentation FlowDocument</title><link>http://blogs.vbcity.com/canoz/archive/2008/10/18/9184.aspx</link><pubDate>Sat, 18 Oct 2008 01:05:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/10/18/9184.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9184.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/10/18/9184.aspx#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9184.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9184.aspx</trackback:ping><description>&lt;P&gt;I have just discovered the most compelling reason to port over any projects I have to Windows Presentation Foundataion (WPF) as well as only starting new projects as a WPF project.&lt;/P&gt;
&lt;P&gt;The reason you ask?&amp;nbsp; Well the answer is one word.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size=5&gt;Printing&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Being a File I/O guy, printing has almost always needed to be a part of most projects that I have written so this is a really big thing for me.&amp;nbsp; Looking back printing with Visual Basic.NET was painful for me at times especially if the document spanned several pages and I don't even want to get into printing with pre .NET Visual Basic.&lt;BR&gt;That, however, is the past and today we take a look at the present and future.&lt;/P&gt;
&lt;P&gt;After creating a &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/10/08/9182.aspx" target=blank&gt;table in a flowdocument&lt;/A&gt; I got to thinking about being ability to print out the flowdocument.&lt;/P&gt;
&lt;P&gt;The WPF PrintDialog class has two methods for printing.&amp;nbsp; The two methods are PrintVisual and PrintDocument.&lt;BR&gt;&lt;BR&gt;This post will deal with the PrintDocument method.&lt;/P&gt;
&lt;P&gt;When you use PrintDocument you don&amp;#8217;t actually pass the flowdocument that you want to print as a parameter, you use a DocumentPaginator object.&lt;/P&gt;
&lt;P&gt;What the documentpaginator does is take the content of the flowdocument and breaks it up into multiple pages (if required) then passes the page(s) to the printer to be printed out.&lt;/P&gt;
&lt;P&gt;After importing the necessary namespaces and declaring two Form level variables&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/001wpfprinting.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I started out with the code to create a flowdocument that goes over more than one page I used the following code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: #c8c8c8; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: green"&gt;' Create the parent FlowDocument...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; flowDoc = &lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; FlowDocument()&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; table2 &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Table()&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; flowDoc.Blocks.Add(table2)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; table2.Columns.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableColumn)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; table2.Columns.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableColumn)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; table2.Columns.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableColumn)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; table2.Columns.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableColumn)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;' Create and add an empty TableRowGroup to hold the table's Rows.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; table2.RowGroups.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableRowGroup())&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;' Add the first (title) row.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; table2.RowGroups(0).Rows.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableRow())&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;' Alias the current working row for easy reference.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; currentRow2 &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableRow()&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2 = table2.RowGroups(0).Rows(0)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; v &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Image&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; v.Source = &lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; BitmapImage(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Uri(&lt;SPAN style="COLOR: #a31515"&gt;"dice.jpg"&lt;/SPAN&gt;, UriKind.Relative))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; v.Height = 80&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; v.Width = 80&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;' Add cells with content to the second row.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2.Cells.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableCell(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Paragraph(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Run(&lt;SPAN style="COLOR: #a31515"&gt;"Loan Report"&lt;/SPAN&gt;))))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2.Cells(0).ColumnSpan = 3&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2.FontSize = 50&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2.Foreground = Brushes.RosyBrown&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2.Cells(0).TextAlignment = TextAlignment.Center&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2.Cells.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableCell(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; BlockUIContainer(v)))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; table2.RowGroups(0).Rows.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableRow())&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2 = table2.RowGroups(0).Rows(1)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2.Cells.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableCell(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Paragraph(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Run(&lt;SPAN style="COLOR: #a31515"&gt;" For: Neil Knobbe, "&lt;/SPAN&gt; &amp;amp; Now.Date.ToLongDateString))))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2.Cells(0).TextAlignment = TextAlignment.Center&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2.Cells(0).ColumnSpan = 4&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; table2.RowGroups(0).Rows.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableRow())&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2 = table2.RowGroups(0).Rows(2)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2.Cells.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableCell(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Paragraph(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Run(&lt;SPAN style="COLOR: #a31515"&gt;"Ammount Borrowed: Borrowed Variable"&lt;/SPAN&gt; &amp;amp; vbCrLf &amp;amp; _&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;SPAN style="COLOR: #a31515"&gt;"Monthly Payment: Payment Variable"&lt;/SPAN&gt; &amp;amp; vbCrLf &amp;amp; _&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;SPAN style="COLOR: #a31515"&gt;"Interest: Interest Variable"&lt;/SPAN&gt; &amp;amp; vbCrLf &amp;amp; _&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;SPAN style="COLOR: #a31515"&gt;"Duration: Duration Variable"&lt;/SPAN&gt; &amp;amp; vbCrLf &amp;amp; _&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;SPAN style="COLOR: #a31515"&gt;"Reason For Loan: Reason Varaible"&lt;/SPAN&gt; &amp;amp; vbCrLf &amp;amp; _&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;SPAN style="COLOR: #a31515"&gt;"Lender: Lender Variable"&lt;/SPAN&gt; &amp;amp; vbCrLf &amp;amp; _&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;SPAN style="COLOR: #a31515"&gt;"Loan Number: LoanNum Variable"&lt;/SPAN&gt;))))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2.Cells(0).ColumnSpan = 2&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow2.Cells(0).Padding = &lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Thickness(10)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;' Create and add an empty TableRowGroup to hold the table's Rows.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; table2.RowGroups.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableRowGroup())&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;' Add the first (title) row.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; table2.RowGroups(1).Rows.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableRow())&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;' Alias the current working row for easy reference.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; currentRow &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableRow()&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow = table2.RowGroups(1).Rows(0)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;' Add the header row with content, &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableCell(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Paragraph(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Run(&lt;SPAN style="COLOR: #a31515"&gt;"Date"&lt;/SPAN&gt;))))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableCell(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Paragraph(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Run(&lt;SPAN style="COLOR: #a31515"&gt;"Balance"&lt;/SPAN&gt;))))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableCell(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Paragraph(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Run(&lt;SPAN style="COLOR: #a31515"&gt;"Payment"&lt;/SPAN&gt;))))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableCell(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Paragraph(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Run(&lt;SPAN style="COLOR: #a31515"&gt;"Interest"&lt;/SPAN&gt;))))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells(0).Foreground = Brushes.RosyBrown&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells(0).TextAlignment = TextAlignment.Left&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells(1).Foreground = Brushes.RosyBrown&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells(1).TextAlignment = TextAlignment.Left&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells(2).Foreground = Brushes.RosyBrown&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells(2).TextAlignment = TextAlignment.Left&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells(3).Foreground = Brushes.RosyBrown&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells(3).TextAlignment = TextAlignment.Left&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; table2.RowGroups(1).Rows.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableRow())&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow = table2.RowGroups(1).Rows(1)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableCell())&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells(0).ColumnSpan = 4&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells(0).BorderThickness = &lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Thickness(0, 5, 0, 0)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells(0).BorderBrush = Brushes.RosyBrown&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; i &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Integer&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;For&lt;/SPAN&gt; i = 2 &lt;SPAN style="COLOR: blue"&gt;To&lt;/SPAN&gt; 25&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; table2.RowGroups(1).Rows.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableRow())&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow = table2.RowGroups(1).Rows(i)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableCell(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Paragraph(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Run(&lt;SPAN style="COLOR: #a31515"&gt;"Column "&lt;/SPAN&gt; &amp;amp; i - 1 &amp;amp; &lt;SPAN style="COLOR: #a31515"&gt;" Entry - "&lt;/SPAN&gt; &amp;amp; i.ToString))))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableCell(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Paragraph(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Run(&lt;SPAN style="COLOR: #a31515"&gt;"Column "&lt;/SPAN&gt; &amp;amp; i - 1 &amp;amp; &lt;SPAN style="COLOR: #a31515"&gt;" Entry - "&lt;/SPAN&gt; &amp;amp; i.ToString))))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableCell(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Paragraph(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Run(&lt;SPAN style="COLOR: #a31515"&gt;"Column "&lt;/SPAN&gt; &amp;amp; i - 1 &amp;amp; &lt;SPAN style="COLOR: #a31515"&gt;" Entry - "&lt;/SPAN&gt; &amp;amp; i.ToString))))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow.Cells.Add(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; TableCell(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Paragraph(&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Run(&lt;SPAN style="COLOR: #a31515"&gt;"Column "&lt;/SPAN&gt; &amp;amp; i - 1 &amp;amp; &lt;SPAN style="COLOR: #a31515"&gt;" Entry - "&lt;/SPAN&gt; &amp;amp; i.ToString))))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;Next&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ScrollView1.Document = flowDoc&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which, once I applied the table to a flowdocument and set the flowdocument to be the document of my FlowDocumentScrollViewer,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01wpfprinting.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;gave me a table with 50 entries, shown in three columns, which I wanted to print.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02wpfprinting.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now that the flowdocument was ready to print all that was left to do was create instance of a WPF PrintDialog and enter the one line of code needed to print the document.&lt;/P&gt;
&lt;P&gt;Yes you heard right, one line of code* to print a WPF flowdocument.&amp;nbsp; How much easier can it get?&amp;nbsp; (And I thought I was happy when the people at MS made reading the entire contents of a file into a single line of code for Visual Studio 2005.&amp;nbsp; I am simple ecstatic about this change to printing!)&lt;/P&gt;
&lt;P&gt;(* &lt;STRONG&gt;Note&lt;/STRONG&gt; &amp;#8211; Although you can accomplish printing with just this one line, there are a few gotchas that you will need to be aware of.&amp;nbsp; I will touch on some of these in a bit.)&lt;/P&gt;
&lt;P&gt;So, the magic line of code is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03wpfprinting.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ok, I hear all you out there going "Ummm.... Neil that looks like 5 lines of code to me not one like you said."&amp;nbsp; Which would be a valid statement and it is true there is a couple more lines of code.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Basically what I have done is put the print code in an If...End If statement which gives displays the printdialog to the user where they can choose their printer and print the document or cancel the print job all together. &lt;BR&gt;&amp;nbsp;&lt;BR&gt;All in all six lines of code to print out a single or multiple page document is nothing.&lt;/P&gt;
&lt;P&gt;What is the code doing then? &lt;/P&gt;
&lt;P&gt;As I mentioned earlier a new instance of a printdialog is created.&amp;nbsp; The printdialog is the window that is shown where you can select which printer you want to print with and other printing options.&lt;/P&gt;
&lt;P&gt;The printdialog is shown as a dialog window and if the user clicks the "OK" button, the flowdocument is cast as a DocumentPaginator object which is used as the first parameter of the printdialog&amp;#8217;s PrintDocument.&amp;nbsp; The second parameter of the printdocument is the name of the document being printed.&amp;nbsp; This name is what is displayed in the print queue of the printer so you can uniquely identify what documents are lined up to be printed.&lt;/P&gt;
&lt;P&gt;The Else portion of the If...End If statement handles if the user clicks the "Cancel" button.&amp;nbsp; A simple message box is displayed letting the user know that the print job has been cancelled.&lt;/P&gt;
&lt;P&gt;That in a nutshell is all that you need to do to print a flowdocument in a WPF application.&lt;/P&gt;
&lt;P&gt;Now for the gotchas that caught me while I tried to print.&lt;/P&gt;
&lt;P&gt;#1)&amp;nbsp; Multiple columns.&amp;nbsp; Let me tell you I this one really got me.&amp;nbsp; When I first tried to print the flowdocument in the image above, I expected the print out to look like the window.&amp;nbsp; Such was not the case.&amp;nbsp; What I ended up with was the entire table printed out on two columns per page over the three pages* the printed document covered.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/04wpfprinting.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This was not quite what I was expecting, but is apparently the default behaviour without having set any properties of the document to match the printer.&amp;nbsp; What I wanted was to have the table fill the entire width of the page.&lt;/P&gt;
&lt;P&gt;(* &lt;STRONG&gt;Note&lt;/STRONG&gt; - As a rather interesting side note here this is not what I got the first time I tried to print this flowdocument.&amp;nbsp; My first results were rather disappointing and I was very disillusioned with what I thought was going to be a much simplified printing process.&amp;nbsp; The image below is my first attempt at printing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/05wpfprinting.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you can see it ended up quite the mess.&amp;nbsp; What happened was that all three pages of the flowdocument got printed in two columns on one page.&amp;nbsp; (If you look real close at the left column you can see the header of the table in the background then the first 8 lines have been printed twice.)&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I can happily report that the fault with this lies with the printer and not how the WPF printdialog sent the document to the printer.&amp;nbsp; I have since tested several other printers and they all print as the multiple columns image.)&lt;/P&gt;
&lt;P&gt;Getting back on track and printing the document on only one column.&lt;/P&gt;
&lt;P&gt;The way to get around having multiple columns is to set the column width of the document to be printed prior to casting it as a documentpaginator object.&amp;nbsp; This is a simple process and requires only one line of code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/06wpfprinting.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What this code does is sets the width of document in the scrollviewer to be the entire printable width of the page.&amp;nbsp; Now when the document is printed the table will span the width of the page.&lt;/P&gt;
&lt;P&gt;#2) Page size.&amp;nbsp; While perhaps not quite as important as multiple columns is getting the proper page size and margins for your printed output.&lt;/P&gt;
&lt;P&gt;You can set the bounds of your document to be printed by setting three properties of the document.&amp;nbsp; The three properties are the PrintableAreaHeight, PrintableAreaWidth and the Thickness.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The PrintableAreaHeight and PrintableAreaWidth properties are pretty self explanatory.&amp;nbsp; The Thickness is what is used for the margin.&amp;nbsp; The thickness can be set with a universal value which will be applied to all sides, or you can set pass different parameters for the margin on each side.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/07wpfprinting.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While it is not essential to set these three properties for printing it does ensure that your document fits the page or pages.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Summary&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;So, with adding in the few lines of code from the two gotchas, I finally was able to print out the report and have it look as I wanted it to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/08wpfprinting.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The entire print code I used was:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/09wpfprinting.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There you have it a quick overview of printing in a WPF application.&amp;nbsp; As I said it is much easier and I have my doubts if I will ever look at starting another WinForms application.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9184.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Tables in a Windows Presentation Foundation FlowDocument</title><link>http://blogs.vbcity.com/canoz/archive/2008/10/08/9182.aspx</link><pubDate>Wed, 08 Oct 2008 00:24:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/10/08/9182.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9182.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/10/08/9182.aspx#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9182.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9182.aspx</trackback:ping><description>&lt;P&gt;vbCity Leader (and Microsoft MVP) &lt;A href="http://blogs.vbcity.com/xtab/" target=blank&gt;Ged Mead&lt;/A&gt; showed how to create a FlowDocument in &lt;A href="http://www.devcity.net/Articles/351/1/article.aspx" target=blank&gt;his article&lt;/A&gt;&amp;nbsp;published on devCity.com.&lt;/P&gt;
&lt;P&gt;I got the challenge recently to display a data inserted in a table in a flowdocument.&amp;nbsp; So I embarked on my quest.&lt;/P&gt;
&lt;P&gt;I knew that what I wanted could be done because some quick testing with XAML I was easily able to add a table to my flowdocument.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/001WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Which gives an output like the following.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;My challenge, however, was that I needed to be able to do this with Visual Basic.NET code behind as the data that was to be displayed in the table was going to be read from a file.&lt;/P&gt;
&lt;P&gt;I made my first mistake almost immediately.&amp;nbsp; (Now that is probably not the best thing for me to admit when I am trying to convince everyone that I actually know what I am talking about, but hey, I am big enough to admit my mistakes.)&lt;/P&gt;
&lt;P&gt;The mistake I made was trying to use the wrong table.&amp;nbsp; I was able to create and insert the data from the file into the table I created with VB code, but when I tried to add the table to the flowdocument I couldn&amp;#8217;t.&amp;nbsp; No matter what I tried, I was just unable to add the table and after a couple of days, I finally gave up and asked for help.&amp;nbsp; Microsoft MVP Jay Harlow&amp;nbsp;quickly pointed me in the right direction.&lt;/P&gt;
&lt;P&gt;What the problem was is that there are more than one table that is accessible for use in the .NET Framework.&amp;nbsp; I was trying to use the table in the &lt;STRONG&gt;System.Web&lt;/STRONG&gt; Namespace, but in fact I needed to be using the table from the &lt;STRONG&gt;System.Windows.Documents&lt;/STRONG&gt; Namespace.&lt;/P&gt;
&lt;P&gt;Once I was referencing the correct table, the whole project came together quite nicely.&lt;/P&gt;
&lt;P&gt;(While the project I was doing required reading data from a file that will be outside the scope of this blog post.&amp;nbsp; In this post I will just be showing how to hardcode data into a table in a flowdocument.)&lt;/P&gt;
&lt;P&gt;The first thing that is needed is to Import the Namespace to give us access to use a table.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Next declare two form level variables.&amp;nbsp; One variable is declared as a flowdocument and the other is declared as a table.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;In the event you want to create the table in, I used the Initialized event of the form for this example, set the two variables to a new instance of a flowdocument and table respectively.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/04WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Now that there is a flowdocument and a table the table needs colums, rows and content for the table.&lt;/P&gt;
&lt;P&gt;The columns are the first things to be added to the table.&amp;nbsp; Columns are added to the collection, or array, of columns of the table.&amp;nbsp; For this example I am going to add four columns to the table.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/05WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;With the columns added, Rows can now be added to the table.&amp;nbsp; Like columns, rows are also held in an array of rows.&amp;nbsp; Where rows differ from columns is rows are actually part of RowGroups.&amp;nbsp; You can have several rows in a rowgroup and more than one rowgroup in a table. 
&lt;P&gt;So to start a new rowgroup must be added to the rowgroups of the table.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/06WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;and into that rowgroup a new row is added.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/07WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Although you still can&amp;#8217;t see it if you were to look at the form itself, the table now has four columns and one row.&amp;nbsp; Into the row Cells need to be added.&lt;/P&gt;
&lt;P&gt;At this point there is a great deal of possibilities to how what the table is going to look like.&amp;nbsp; While you can set some formatting for the table with changing the properties of the table and rows, you have much greater control over the look of the table by manipulating the properties of the cells.&lt;/P&gt;
&lt;P&gt;For this table I want to have a header that stretches across the entire top of the table, so while I can have four cells in the row (I can do this because I added four columns to the table earlier) only one is going to be added to the row.&amp;nbsp; The cell will then be made to stretch over the entire width of the table.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/08WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;There is quite a bit going on in the above line of code.&amp;nbsp; A new TableCell is added to the collection of cells of the row and to add content to the cell a new Paragraph is used as a parameter of the tablecell and a new Run of text is passed as a parameter of the paragraph.&lt;/P&gt;
&lt;P&gt;After adding what is going to be the title of the table, some formatting can be assigned.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/09WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;The first line of code above tells the cell to span the entire width of the four columns of the table.&amp;nbsp; (If you have worked with tables in Microsoft Word think of this process to be like merging cells in a table.) 
&lt;P&gt;The second line sets the size of the font to make the text stand out as a title and the third line centers the text in the cell.&amp;nbsp; (By default the text alignment of a table, row or cell is left.)&lt;/P&gt;The fourth line of code makes the font bold. 
&lt;P&gt;The fifth line of code sets the colour of the text in the cell and the sixth line gives the cell a colour for the background.&lt;/P&gt;If we add two more lines of code the table can be shown in the FlowDocumentReader. 
&lt;P&gt;The table is first added to the Blocks of the flowdocument that was declared at the beginning of our code then the flowdocument is assigned as the document of the FlowDocumentReader of the form.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/10WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;(&lt;STRONG&gt;Note&lt;/STRONG&gt;:&amp;nbsp; Interestingly enough it does not seem to matter where you place the code to add the table into the flowdocument and make the document of the reader to be your flowdocument.&amp;nbsp; The code can be added just after the declaration of the flowdocument and table or anywhere in the middle of the code that formats and populates the table.&amp;nbsp; Personally I put these two lines at the very end prior to displaying the flowdocument.)&lt;/P&gt;
&lt;P&gt;Now when the project is run, you can see the table starting to take shape.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/11WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Putting Headers for each column are next to be added to the table.&lt;/P&gt;
&lt;P&gt;A new row is added to the rowgroup of the table then four cells are added to the row with content also being added to each cell.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/12WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;You can see by the Index number of the rows that the new cells have been added to the second row.&amp;nbsp; Like all .NET arrays the rows array of a rowgroup, as is the rowgroup itself, are zero based so if you need to remember that the actual row number is one higher than the index number. 
&lt;P&gt;Running the project shows that the columns now have headers.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/13WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The table is really starting to look like a table now.&lt;/P&gt;
&lt;P&gt;A line under the column headers keeps the data in the columns separated from the headers.&amp;nbsp; To accomplish this, a new row is added under the row of headers.&amp;nbsp; One cell is added to the row and it will span the four columns like the title cell does.&amp;nbsp; To make the line, the border property of the cell is going to be used.&amp;nbsp; The top border of the cell will be made larger and given a colour.&lt;/P&gt;
&lt;P&gt;To make the border thicker a New Thickness is applied to the cell.&amp;nbsp; Thickness can either be set by passing a single parameter to the new thickness, which would give the same thickness to all sides of the cell, or you can pass four parameters and assign separate thicknesses to each side.&amp;nbsp; While it does not make any difference to what I am demonstrating here, I have only assigned a thickness to the top border of the cell.&amp;nbsp; I could have just as easily assigned a uniform thickness to the cell.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/14WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Now the contents of the table will be separated from the column headers by a red line.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/15WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;With the formatting of the table set out, it is time to add some content into the table itself.&lt;/P&gt;
&lt;P&gt;For this example I am going to use a For&amp;#8230;Next Loop to populate the table.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/16WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Two Integer variables are declared.&amp;nbsp; The first is used to keep track of the index of the row in the rowgroup.&amp;nbsp; The variable is declared with a value of 3 because the first line that will be added in the loop will be the fourth element of the array of rows.&amp;nbsp; The second variable is just used for adding content to each of the cells as they are added to the row.&lt;/P&gt;
&lt;P&gt;In the loop the first line of code adds a new row to the table then the next four lines add the cells to the row and put some content in the cell.&amp;nbsp; In this example the content of the cells in the row will just have the text "Number: 0" to "Number: 97".&lt;/P&gt;
&lt;P&gt;In the last line the value of the variable j is incremented by 1 so the content number of the next row will be one higher than the last.&lt;/P&gt;
&lt;P&gt;Now when the project is run the table is complete.&amp;nbsp; The table starts with:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/17WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;
&lt;P&gt;and six pages later going to:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/18WPFFlowDocumentTable.jpg"&gt;&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9182.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Windows Presentation Foundation ToolTip</title><link>http://blogs.vbcity.com/canoz/archive/2008/10/07/9180.aspx</link><pubDate>Tue, 07 Oct 2008 23:39:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/10/07/9180.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9180.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/10/07/9180.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9180.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9180.aspx</trackback:ping><description>&lt;P&gt;Once again it seems that I had what I thought was a great idea only to find out that someone else had it before I did.&lt;/P&gt;
&lt;P&gt;I don&amp;#8217;t even know how I got to thinking about ToolTips and how boring they look, but I did and that got me to wondering what could be accomplished with Windows Presentation Foundation (WPF).&lt;/P&gt;
&lt;P&gt;What I eventually ended up with was using a Border which I would create custom messages in and display when the mouse was hovered over the object that the ToolTip was for.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01WPFToolTip.jpg"&gt;&lt;/P&gt;
&lt;P&gt;All in all I was fairly pleased with how it all looked and worked though it was kind of fiddly to implement.&amp;nbsp; I wasn&amp;#8217;t really sure, however, how to incorporate this tooltip idea into an application I did want to use it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That was, however, before I found out about the versatility of a WPF tooltip.&lt;/P&gt;
&lt;P&gt;In WPF, the tooltip is actually just a container like a panel or grid and pretty much anything that you can put into a container you can now use in a tooltip.&amp;nbsp; This expanded capability leads to endless possibilities for how a tooltip looks and how the user can now interact with it.&lt;/P&gt;
&lt;P&gt;We all know how boring tooltips look in a WinForms application.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02WPFToolTip.jpg"&gt;&lt;/P&gt;
&lt;P&gt;With just a few lines of code, this plain tooltip can be transformed into something a little more visually exciting.&lt;/P&gt;
&lt;P&gt;The tooltip in the next image was formatted with just six lines of code.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03WPFToolTip.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The code for this was pretty straight forward.&lt;/P&gt;
&lt;P&gt;A gradient was applied to the background of the tooltip.&amp;nbsp; Creating a &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/07/16/9136.aspx" target=blank&gt;gradient colour&lt;/A&gt; is the same process as creating a gradient for anything in a WPF application.&amp;nbsp; You can have as few as two colours up to a virtually endless number of colours.&amp;nbsp; A gradient is also applied to the border of the tooltip as well.&lt;/P&gt;
&lt;P&gt;The thickness of the border was increased so the colouring is more noticeable.&lt;/P&gt;
&lt;P&gt;The content is filled with what we wanted to have the tooltip say and added a drop shadow effect to give the tooltip a little bit of a 3D effect.&lt;/P&gt;
&lt;P&gt;The last property that is set is the Placement property.&amp;nbsp; The placement property allows you to set where the tooltip is displayed in relation to the control that it is for.&amp;nbsp; Some of the positions that you can place the tooltip are Top, Left, Right and Bottom.&amp;nbsp; You can also set an Absolute or Relative position for the tooltip.&lt;BR&gt;The last thing to do is set the tooltip that has just been defined as the tooltip of the control it is to be displayed for.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/04WPFToolTip.jpg"&gt;&lt;/P&gt;
&lt;P&gt;In addition to being able to customize the tooptip itself I mentioned earlier that you can place WPF content into the tooltip itself.&amp;nbsp; One drawback to putting WPF content into a tooptip you do still will see the thin border of the tooltip behind the WPF content.&amp;nbsp; I&amp;#8217;m sure that there must be a way to get rid of the border, and with Vista it is not as noticeable, I just have not found the way to do it yet.&lt;/P&gt;
&lt;P&gt;So with this in mind we will forge ahead with making an even more visual tooltip.&lt;/P&gt;
&lt;P&gt;The first component required for creating a tooltip for WPF content would be some sort of container.&amp;nbsp; In this example I am going to start with a StackPanel.&lt;/P&gt;
&lt;P&gt;In the stackpanel there is going to be some text and an image so the code is going to start with declarations for the three objects.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/05WPFToolTip.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Add some formatting to the stackpanel.&amp;nbsp; In this case there are only two changes which are going to be applied to the stackpanel.&amp;nbsp; A LinearGradientBrush is going to be applied to the background and the Orientation of the stackpanel is also set.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/06WPFToolTip.jpg"&gt;&lt;/P&gt;
&lt;P&gt;For the Image there are just three properties that are going to be set.&amp;nbsp; The source, height and width of the image are defined.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/07WPFToolTip.jpg"&gt;&lt;/P&gt;
&lt;P&gt;For the textblock the content is set as well as some text formatting and the text is also centered in the textblock.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/08WPFToolTip.jpg"&gt;&lt;/P&gt;
&lt;P&gt;All that is left now is to add the image and textblock to the stackpanel then apply the stackpanel to be the tooltip of the textbox on the Form.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/09WPFToolTip.jpg"&gt;&lt;/P&gt;
&lt;P&gt;All this work now gives a much&amp;nbsp;more fancy&amp;nbsp;tooltip, looking like the following image.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/10WPFToolTip.jpg"&gt;&lt;/P&gt;
&lt;P&gt;So you can see that the boring old tooltip is now a thing of the past.&lt;/P&gt;This post has only scratched the surface of what can be done with a tooltip in a WPF application.&amp;nbsp; I plan on investigating this tool much more to see just what can be done with it.
&lt;P&gt;You will need to keep in mind that you can&amp;#8217;t put content into the tooltip that can have user interaction because the tooltip can&amp;#8217;t get focus.&amp;nbsp; If you put something like a button in a tooltip, which you can do with WPF, the click would just go through the button and click onto the control on the form.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9180.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Automatically resize a Windows Presentation Foundation Form.</title><link>http://blogs.vbcity.com/canoz/archive/2008/08/17/9164.aspx</link><pubDate>Sun, 17 Aug 2008 01:17:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/08/17/9164.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9164.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/08/17/9164.aspx#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9164.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9164.aspx</trackback:ping><description>&lt;P&gt;Once again it seems that a &lt;A href="http://www.vbcity.com/forums/topic.asp?tid=156162&amp;amp;page=1" target=_blank&gt;post from vbCity&lt;/A&gt; is to be fodder for a post here.&lt;/P&gt;
&lt;P&gt;Although not part of the original query by vbcity member quicksun, the question of getting a Windows Presentation Foundation (WPF) Form to be resized as the expander control was either expanded or collapsed came up.&lt;/P&gt;
&lt;P&gt;I went with what I thought was the quickest way about resizing the Form and that was to use the Collapse and Expand events of the expander control to reset the height of the WPF Form to its desired size.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/P&gt;
&lt;DIV style="OVERFLOW: auto; HEIGHT: 125pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt; Expander1_Collapsed(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; sender &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Object&lt;/FONT&gt;, &lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; e &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; System.Windows.RoutedEventArgs) &lt;FONT color=#0000ff&gt;Handles&lt;/FONT&gt; Expander1.Collapsed 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Win1.Height -= 40&amp;nbsp;&amp;nbsp;&lt;FONT color=#008000&gt;' Set the Height back to original size.&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;BR&gt;&lt;BR&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt; Expander1_Expanded(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; sender &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Object&lt;/FONT&gt;, &lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; e &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; System.Windows.RoutedEventArgs) &lt;FONT color=#0000ff&gt;Handles&lt;/FONT&gt; Expander1.Expanded 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Win1.Height += 40&amp;nbsp;&amp;nbsp;&lt;FONT color=#008000&gt;' Set the Height to new size.&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;As simple an approach as the above code is there is an easier way to resize the Form thanks to the increased control programmers have been given over forms and controls with WPF.&lt;/P&gt;
&lt;P&gt;With a WPF Form there is a property named SizeToContent.&amp;nbsp; By utilizing this property you can make the Form resize itself depending on, as the name implies, the content of the Form.&lt;/P&gt;
&lt;P&gt;There are four setting for the SizeToContent property.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01formresize.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Manual&lt;BR&gt;&lt;/STRONG&gt;If you have SizeToContent set to Manual then the size of the WPF Form will not change from what is initially declared as the size of the Form either in the XAML or code behind of the Form.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Height&lt;/STRONG&gt;&lt;BR&gt;Setting the SizeToContent property to Height would mean that only the height of the Form will automatically change should the height of the Forms content become greater than the height of the Form.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Width&lt;/STRONG&gt;&lt;BR&gt;Similar to the Height setting, by setting the SizeToContent property to Width would mean that a WPF Form would automatically change widths should the Forms content become greater than the width of the Form.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;WidthAndHeight&lt;BR&gt;&lt;/STRONG&gt;As you can probably guess by the name of the setting, WidthAndHeight would mean that the WPF Form can change size in both width and height should the Forms content be greater than the current size of the Form.&lt;/P&gt;
&lt;P&gt;If you do use the SizeToContent setting you must remember that you can not specify a height, width or both depending on which setting you have.&amp;nbsp; If you want to give your WPF Form the ability to change in a direction then you must not declare a size for that property.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;For example if you want the WPF Form to be able to grow taller (height) then you would change the SizeToContent property to Height and not declare any value for the height of the WPF Form either in the XAML or property window.&lt;/P&gt;
&lt;P&gt;All in all I think this is a nice little addition to what we can do with Forms.&amp;nbsp; &lt;BR&gt;&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9164.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Reaching the code behind with Windows Presentation Foundation</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/16/9137.aspx</link><pubDate>Wed, 16 Jul 2008 14:58:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/16/9137.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9137.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/16/9137.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9137.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9137.aspx</trackback:ping><description>&lt;P&gt;I mentioned in an &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/06/29/9108.aspx" target=_blank&gt;earlier post &lt;/A&gt;that for a control in a Windows Presentation Foundation (WPF) application that you had to give each control that you wanted to write code behind for a name in the XAML of the form.&lt;/P&gt;
&lt;P&gt;Strictly this is not true.&amp;nbsp; If you want don&amp;#8217;t want to use the built in features of the Visual Studio&amp;#8217;s IDE for selecting classes and methods on the code behind page you could type in the code on the code behind yourself.&lt;/P&gt;
&lt;P&gt;For me, at least, the easiest way to reach the code behind is to give each control a name in the XAML markup&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01codebehind.jpg"&gt;&lt;/P&gt;
&lt;P&gt;then from the code behind page, you can select the control from the dropdown list.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02codebehind.jpg"&gt;&lt;/P&gt;
&lt;P&gt;After you select the control, you have access to all the events associated with the particular control.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03codebehind.jpg"&gt;&lt;/P&gt;
&lt;P&gt;By selecting a method from the list Visual Studio automatically generates the method declaration for you.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/04codebehind.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Once the declaration is made you can happily enter the necessary code you want for that event.&lt;/P&gt;
&lt;P&gt;If you don&amp;#8217;t want to take advantage of this great feature of Visual Studio, then you can write methods for controls the slightly more difficult way.&lt;/P&gt;
&lt;P&gt;Instead of giving your control a name in the XAML of the form, have toadd an&amp;nbsp;attributes for the control in the XAML.&lt;/P&gt;
&lt;P&gt;The attribute&amp;nbsp;needs to include are the action of the control you want to code against and the name of the method that you will write on the code behind.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/05codebehind.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Once you have added this to the XAML, go to the code behind and declare the method adding the two required parameters of Object and RoutedEventArgs.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/06codebehind.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Then you can add the required code for that method just as you would if you had Visual Studio declare the method for you.&lt;/P&gt;
&lt;P&gt;So there you have it.&amp;nbsp; Two ways to reach the code behind with a Windows Presentation Foundation (WPF) application.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9137.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Setting background colours with Windows Presentation Foundation</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/16/9136.aspx</link><pubDate>Wed, 16 Jul 2008 14:48:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/16/9136.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9136.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/16/9136.aspx#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9136.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9136.aspx</trackback:ping><description>&lt;P&gt;I don't think I will ever get over just how much easier it is to do some things in a Windows Presentation Foundation (WPF) application than it is in a Windows application.&lt;/P&gt;
&lt;P&gt;I was messing around with changing the background colour of a button to see what could be done.&amp;nbsp; I ended up looking at how to apply a gradient to be the background of a button and realized that doing gradients with Visual Basic was just about as easy, if not easier, than creating them by modifying XAML markup.&amp;nbsp; (You could also easily create gradients for the background properties of controls in a couple of mouse clicks by using Expression Blend.)&lt;/P&gt;
&lt;P&gt;I started out with a plain button on my Form.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Like all experiments of mine I started off with the basics.&amp;nbsp; I wanted to have a button with a two colour gradient background so I declared a variable as a LinearGradientBrush.&amp;nbsp; (&lt;STRONG&gt;Note&lt;/STRONG&gt; - Now before I hear back from people saying: "You could have declared and set your variable on one line&amp;#8230;" or "You could have just set the Background property&amp;#8230;." ... I know.&amp;nbsp; Due to limitations with taking the screen shots (the screen resolution didn't allow me to get the whole line of code without scrolling or having the code on multiple lines) I wanted everything to be as easy to read as possible.)&lt;/P&gt;The next thing I did was declare the variable as a New LinearGradientBrush and set the parameters which were the starting colour, the finishing colour and the angle that I wanted to gradient to be displayed at.&amp;nbsp; A 0 degree angle shows the gradient from left to right and a 90 degree angle shows the gradients from top to bottom.&amp;nbsp; You can also declare any degree from 0 to 360. (I thought that being able to change the angle of the gradient this easily was a wonderful feature.) 
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Then all that was left was to apply the brush to the background property of the button.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Run the project and I had the desired effect of a button with a two colour gradient background.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/04backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Now my creative juices started flowing and I got to wondering about having more than two colours in the gradient.&lt;/P&gt;
&lt;P&gt;(&lt;STRONG&gt;Note&lt;/STRONG&gt; - I have apologized in the past for my rather horrible colour matching abilities and I will do so again now and warn those who have not witnessed my graphical abilities to be prepared.)&lt;/P&gt;
&lt;P&gt;Having more than two colours for a gradient background is just as easy as a two colour gradient.&amp;nbsp; One of the overloaded constructors of the LinearGradientBrush is to pass an array of gradient stops as one of the parameters.&lt;/P&gt;
&lt;P&gt;To create the array of gradient stops, you start be declaring and defining variables as New GradientStops.&amp;nbsp; The overloaded constructor for a gradient stop requires that you pass a colour and an offset.&amp;nbsp; (The offset is where the colour is at its full colour in the gradient.&amp;nbsp; The first colour starts at 0 and the last colour ends at 1).&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/05backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;For my button I decided to try three colours and have the colours starting with red on the left then becoming green in the middle and then changing to from green to blue on the right side. &lt;/P&gt;
&lt;P&gt;Next I needed to declare an array to hold the gradient stops in.&amp;nbsp; The type of array that is used for this is a GradientStopCollection and you add the gradient stops to the array by using the Add method.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/06backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;With all the gradient stops in the array/collection, you then set the background of the button as a New LinearGradientBrush and pass the array and an angle for the gradient as parameter to the overloaded new constructor for the brush.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/07backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Now when the project is run, the three colours are displayed on the button.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/08backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;I mentioned the angle parameter of the constructor for the LinearGradientBrush earlier and changing it can lead to some very different looks.&lt;/P&gt;
&lt;P&gt;Using the same code for the three colour button, but changing the angle of the gradient to 45 degrees&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/09backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;the colour change goes from the top left corner of the button to the bottom right.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/10backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;One thing I did notice once I started changing the angle of the gradient I did find that if I wanted the gradient to show evenly I would also have to also change the offset property of the first and middle colours to even out the effect.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/11backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;By changing the offset of the red, there is a little more solid red on before the colour starts mixing with the green.&amp;nbsp; The offset of the green is moved over by .2 as well to keep the green close to the middle of the button.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/12backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;By using the GradientStopCollection adding more colours is a breeze.&amp;nbsp; You just need to create another gradient stop and then add that to the collection.&lt;/P&gt;
&lt;P&gt;As you can see doing gradient colours is now a simple process with Windows Presentation Foundation (WPF) and Visual Basic.NET 2008.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9136.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Project for all VB TabControl content</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/11/9131.aspx</link><pubDate>Fri, 11 Jul 2008 00:36:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/11/9131.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9131.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/11/9131.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9131.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9131.aspx</trackback:ping><description>&lt;P&gt;I have uploaded the project showing how to do all the Tab content which I posted in &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/07/10/9128.aspx" target=_blank&gt;this post&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The project can be downloaded from &lt;A href="http://www.neilknobbe.com/projects/TabControl_pureVB.zip" target=_blank&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9131.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>TabControl with WPF and Visual Basic.NET 2008 revisited</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/10/9128.aspx</link><pubDate>Thu, 10 Jul 2008 16:25:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/10/9128.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9128.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/10/9128.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9128.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9128.aspx</trackback:ping><description>&lt;P&gt;When I last visited the TabControl project, I changed it so that the look of the Tab content was done via VB.&amp;nbsp; One thing that has been niggling at me since was how the first Tab content was done.&lt;/P&gt;
&lt;P&gt;The content on the Tab was still entered on the XAML code and the spans were defined there as well so the look could was not really created purely with VB.&amp;nbsp; Since I was after creating the look with VB, the first Tab also be included with this rather than a mixture of XAML and VB.&lt;/P&gt;
&lt;P&gt;I did find that getting the same visual look took a lot more lines of code but, if you were to use the same process on a TextBlock, adding more text in various styles during run time could be done.&lt;/P&gt;
&lt;P&gt;The beginning XAML for the Tab is now very basic with just a Grid on it.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01TabControl_pureVB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;On the code behind starts with declaring variables for both a TextBlock and a Span.&lt;/P&gt;
&lt;P&gt;The textblock is going to be placed inside the grid on the tab and the span is going to end up being the content of the textblock.&lt;/P&gt;Using a span for this is really great.&amp;nbsp; A span is used for grouping a set of different inline content together.&amp;nbsp; Thus allowing several different look to be incorporated in the same span and the really great thing about spans is that they are not inherited so each inline element you add to a span can have its own totally separate look.&amp;nbsp; You don&amp;#8217;t need to get rid of the formatting of the previous element before applying a new formatting. 
&lt;P&gt;The first line I add to the span is going to be in plain text.&amp;nbsp; The text is added by passing the text I want as a Parameter of the Run Class.&amp;nbsp; The run class is an inline content element that may contain either formatter or unformatted text.&amp;nbsp; So basically it is a container for the text I want to add to the span.&lt;/P&gt;
&lt;P&gt;The run is passed into the Add method of the Inlines property.&amp;nbsp; The inlines property is actually a collection of inline elements which make up the span.&lt;/P&gt;From this plain text beginning it is just a matter of declaring a new span for the style that is wanted to be added next, defining the style and adding that span to the inlines collection of the root span. 
&lt;P&gt;One the span is formatted as is wanted, the textblock is added to the grid on the tab and the Span is applied to the inlines property of the textblock.&lt;/P&gt;
&lt;P&gt;Initially I thought that the property of the textblock to apply the span to would have been the text property, but after a little digging I found that because a span is an inline property, it needed to be included in the inline collection of the control.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02TabControl_pureVB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Running the App shows that all the formatting that is set with the code behind is working perfectly.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03TabControl_pureVB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Thus giving a more pure VB setup of the tab contents.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9128.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Gadget style window with WPF and Visual Basic.NET 2008 Project</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/06/9124.aspx</link><pubDate>Sun, 06 Jul 2008 23:45:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/06/9124.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9124.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/06/9124.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9124.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9124.aspx</trackback:ping><description>&lt;P&gt;I have uploaded the project for the &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/06/29/9108.aspx" target=_blank&gt;Gadget Style Window&lt;/A&gt; with one minor change.&amp;nbsp; Beethoven is out and a small midi file has replaced it.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I know that some of you are probably saddened as I am by Beethoven's departure, but I didn't want to subject everyone to a 30Mb+ download.&lt;/P&gt;
&lt;P&gt;The project can be downloaded from &lt;A href="http://www.neilknobbe.com/projects/Gadget_VB.zip" target=_blank&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9124.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>TabControl with WPF and XAML Project</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/05/9121.aspx</link><pubDate>Sat, 05 Jul 2008 23:56:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/05/9121.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9121.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/05/9121.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9121.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9121.aspx</trackback:ping><description>&lt;P&gt;I have made the project that goes with the post for the &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/04/12/9029.aspx" target=_blank&gt;TabControl with WPF&lt;/A&gt;&amp;nbsp;available for download.&lt;/P&gt;
&lt;P&gt;The project can be downloaded from &lt;A href="http://www.neilknobbe.com/projects/TabControl_XAML.zip" target=_blank&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Again I must apologise for the file size.&amp;nbsp; Like the project for the &lt;A href="http://www.neilknobbe.com/projects/TabControl_VB.zip" target=_blank&gt;Visual Basic.NET version&lt;/A&gt;&amp;nbsp;of the TabControl it is a little bloated due to the video file.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9121.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>TabControl with WPF and Visual Basic.NET 2008 Project</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/05/9119.aspx</link><pubDate>Sat, 05 Jul 2008 16:44:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/05/9119.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9119.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/05/9119.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9119.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9119.aspx</trackback:ping><description>&lt;P&gt;Sometimes it just takes me a while, but I finally got to the point where I figured I should also be including the Visual Basic projects to go along with the posts and the videos. &lt;/P&gt;
&lt;P&gt;You can download the project that goes along with the &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/07/05/9117.aspx" target=_blank&gt;TabControl with WPF and Visual Basic.NET 2008&lt;/A&gt; post.&lt;/P&gt;
&lt;P&gt;The project can be downloaded from &lt;A href="http://www.neilknobbe.com/projects/TabControl_VB.zip" target=_blank&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;My apologies for the size of the file.&amp;nbsp; It is a little bloated because of having the video file.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9119.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>TabControl with WPF and Visual Basic.NET 2008</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/05/9117.aspx</link><pubDate>Sat, 05 Jul 2008 02:44:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/05/9117.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9117.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/05/9117.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9117.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9117.aspx</trackback:ping><description>&lt;P&gt;A while back &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/04/12/9029.aspx" target=_blank&gt;I posted up&lt;/A&gt; about showing more interesting content on that tab of a tab control using Windows Presentation Foundation (WPF).&lt;/P&gt;
&lt;P&gt;In the example that I posted, I created the custom look of the tab control just using XAML and I thought that it would be good to also show how to do the same thing using Visual Basic.&lt;/P&gt;
&lt;P&gt;To do this I decided to cut back to the basics for the content of the tabs and I started with a tab control with four tabs.&amp;nbsp; The first tab had a textblock with some text as well as a couple style blocks in it.&amp;nbsp; The second tab starts with a stack panel.&amp;nbsp; The third and fourth tabs have grids on them.&lt;/P&gt;
&lt;P&gt;The XAML for my base project is.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 125pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Window&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Class&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Window1"&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#ff0000&gt; xmlns&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#ff0000&gt; xmlns&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/FONT&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Window1"&lt;/FONT&gt;&lt;/DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#ff0000&gt; Title&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Window1"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Height&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="437"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Width&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="532"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; WindowStartupLocation&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="CenterScreen"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Form1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabControl&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TextBlock&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab1TextBlock"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Span&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab1TbSpan1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Words&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Span&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Span&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab1TbSpan2"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;in&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Span&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Span&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab1TbSpan3"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Italics&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Span&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TextBlock&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab2"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;StackPanel&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Stack"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Orientation&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Horizontal"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;StackPanel&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab3"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Grid1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Grid2"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabControl&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Window&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;The window does not look too interesting yet,&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;but we will make it look better soon.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Tab 1&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Within the XAML of the text block that is in the first tab, I have added in where I want the different styles to be.&amp;nbsp; I have giving the each span block a name so that it can be referenced by the code behind.&lt;/P&gt;
&lt;P&gt;There are different ways to go about this depending on what you want to do.&amp;nbsp; As you will see I have created one style with several different properties, since I am only going to be setting one property per span block I have only created one new style, or you can create a new style for each span block if you are going to have different styles for overlapping properties.&lt;/P&gt;
&lt;P&gt;I started off by declaring a variable as a New Span, then I set the properties for the variable that I wanted.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 100pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; s &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Span&lt;BR&gt;&lt;BR&gt;s.Foreground = Brushes.Blue&lt;BR&gt;s.FontWeight = FontWeights.Bold&lt;BR&gt;s.FontStyle = FontStyles.Italic&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;Now that I have the properties set, I just need to assign them to the various spans that I have on my tab.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 60pt; BACKGROUND-COLOR: #dcdcdc"&gt;Tab1TbSpan1.Foreground = s.Foreground&lt;BR&gt;Tab1TbSpan2.FontWeight = s.FontWeight&lt;BR&gt;Tab1TbSpan3.FontStyle = s.FontStyle&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;Tab one now has something more elaborate on it.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Admittedly, I could have just used Brushes.Blue to set the Foreground of the first span, but by creating and using a new span I can now re-use this over and over in my code if I wanted to and if I wanted to change the colour, then I would only have to change one line of code rather than possibly having to several to change.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Tab 2&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Tab 2 starts out with a stack panel on it with the orientation of the stack panel set to horizontal.I could have set the orientation of the stack panel with VB code if I wanted by using:&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 40pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;With&lt;/FONT&gt; Stack 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Orientation = Orientation.Horizontal&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;End With&lt;/FONT&gt;&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;if I wanted.&lt;/P&gt;
&lt;P&gt;In the stack panel I am going to place a text block, a rectangle and a circle.&lt;/P&gt;
&lt;P&gt;To add the text block, I need to start out with declaring a new text block then set the Text property.&amp;nbsp; With that done the last line of code adds the text block to the stack panel.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 60pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;With&lt;/FONT&gt; tb &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; TextBlock&lt;BR&gt;&lt;BR&gt;tb.Text = &lt;FONT color=#a31515&gt;"Circles and Rectangles"&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;Stack.Children.Add(tb)&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;I now have a caption on the second tab.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Next I want to have a circle showing on the tab, so I declare a variable to hold a new ellipse and then set the Height, Width, and Fill.&amp;nbsp; I also set the Margin for the ellipse to a new thickness and pass the numeric representations of left, top, right and bottom to position the ellipse on the tab.&amp;nbsp; Once I have the properties I want set, I add the ellipse to the stack panel.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 90pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; c &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Ellipse&lt;BR&gt;&lt;BR&gt;c.Height = 20&lt;BR&gt;c.Width = 20&lt;BR&gt;c.Fill = Brushes.Blue&lt;BR&gt;c.Margin = &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Thickness(10, 0, 0, 0)&lt;BR&gt;&lt;BR&gt;Stack.Children.Add(c)&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;Tab 2 now has a caption and a circle on it.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/04TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The last item I wanted on the tab was a rectangle, so I did much the same for this as for adding the ellipse.&amp;nbsp; I declared a variable to hold a new rectangle then set the Height, Width and Fill.&amp;nbsp; Again I set the margin property to a new thickness to position the rectangle on the tab.&amp;nbsp; Then I added the rectangle to the stack panel.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 90pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; r &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Rectangle&lt;BR&gt;&lt;BR&gt;r.Height = 15&lt;BR&gt;r.Width = 25&lt;BR&gt;r.Fill = Brushes.Red&lt;BR&gt;r.Margin = &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Thickness(10, 0, 0, 0)&lt;BR&gt;&lt;BR&gt;Stack.Children.Add(r)&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;I now have my desired look for the second tab.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/05TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Tab 3&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;Tab 3 will hold an image.&lt;/P&gt;
&lt;P&gt;Once again I start off by declaring a variable which will hold a new image, then set the Width and Source properties.The source property is declared as a New BitmapImage and the path of the image file, as well as what kind of Uri the path is, are passed as parameters of the Uri of the file.&amp;nbsp; The image control is then added to the grid on the tab.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 70pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; v &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Image&lt;BR&gt;&lt;BR&gt;v.Width = 80&lt;BR&gt;v.Source = &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; BitmapImage(&lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Uri(&lt;FONT color=#a31515&gt;"Lizard004_RJ.JPG"&lt;/FONT&gt;, UriKind.Relative))&lt;BR&gt;&lt;BR&gt;Grid1.Children.Add(v)&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;The third tab now displays an image.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/06TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Tab 4&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The last tab on my tab control is going to display a video.&lt;/P&gt;
&lt;P&gt;I start out by declaring a variable to hold a new instance of a media element, then set the Width and Source properties of the element before adding the control to the grid on the fourth tab. &lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 60pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; m &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; MediaElement&lt;BR&gt;&lt;BR&gt;m.Width = 80&lt;BR&gt;m.Source = &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Uri(&lt;FONT color=#a31515&gt;"butterfly.wmv"&lt;/FONT&gt;, UriKind.Relative)&lt;BR&gt;&lt;BR&gt;Grid2.Children.Add(m)&lt;BR&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;The tab now displays the video and completes the effect I was after.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/07TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;So you can see that it can be just as easy to do in Visual Basic what you can with XAML.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9117.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>