<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>WPF</title><link>http://blogs.vbcity.com/xtab/category/204.aspx</link><description>Creating the Windows "Forms" UIs we always dreamed of.</description><managingEditor>Ged Mead</managingEditor><dc:language>et</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>Ged Mead</dc:creator><title>WPF Basics: Using Animation to Fade Colors In and Out</title><link>http://blogs.vbcity.com/xtab/archive/2008/05/07/9058.aspx</link><pubDate>Wed, 07 May 2008 21:03:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2008/05/07/9058.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/9058.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2008/05/07/9058.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/9058.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/9058.aspx</trackback:ping><description>&lt;FONT face=verdana size=2&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;One of the great things about WPF is its ability to let you use animation to enhance your user interface. (Or wreck it if you go too far!) In my opinion, subtle animations can go a long way towards improving the user experience. &lt;/P&gt;
&lt;P&gt;&amp;nbsp; One particular way is to fade colors in and out so that text seems to appear and disappear in a way that gives the impression of movement, but without any jarring visual effects.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Doing this in the XAML markup is well documented and you will find many examples around the place. However, I recently had a situation where I wanted to create this animation in the VB code behind. Now, I knew that anything that could be done in XAML can be done in VB, but when it came down to the task it actually caused me more problems than I'd expected. And when I started to search for answers, it took a while. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;It turned out that the reason for my difficulty was a fundamental misunderstanding on my part. I was thinking "color" as being the element to change or animate; in reality it doesn't work quite like that. But after a good deal of trial and error, I eventually hit on the answer. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; In this case I wanted to fade the text on a button from its original black to white. But because I would use this effect in a number of situations, including some where there was no user driven event to fire it, I decided that putting the animation instructions in the code behind was the way to go. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;I'll start with the XAML though, as I think that in most cases this will be your preferred route. I'll cover the VB approach at the end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;here's the XAML:&lt;/P&gt;
&lt;P&gt;
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 10pt"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #f5f8d6"&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=#800000&gt;Button&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Margin&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="30,67,0,111"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Button1"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Foreground&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Black"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; HorizontalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Left"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;Animated Button&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;Button&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;Button&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; HorizontalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Right"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Margin&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="0,77,96,111"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Button2"&lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Click&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Button2_Click"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Content&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Animated Button"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; &amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;Button.Triggers&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;EventTrigger&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; RoutedEvent&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Button.Click"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;BeginStoryboard&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;Storyboard&lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; TargetProperty&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Foreground.Color"&amp;gt;&lt;BR&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;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;ColorAnimation&lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; To&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="White"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Duration&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="0:0:2" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;Storyboard&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;BeginStoryboard&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;EventTrigger&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;Button.Triggers&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;BR&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;Button&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;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Most of it is pretty straightforward:&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;1. &amp;nbsp;Having first created the button and set its main visual properties, we create a Triggers block for the Button.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;2. &amp;nbsp;Next we identify the trigger to be used to fire this animation. In this case it is the Button's Click event. &lt;/P&gt;
&lt;P&gt;3.&amp;nbsp;&amp;nbsp;The Storyboard is then created and we identify the Target Property which is the Foreground Color of the button. &lt;/P&gt;
&lt;P&gt;4.&amp;nbsp;&amp;nbsp; Finally, the animation details which comprise the starting color, the ending color and the duration in seconds. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;The remainder of that code snippet are closing tags.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Now it's the fact that the TargetProperty is identified as the Foreground.Color that threw me off the track when I came to create a VB version of this task. I was trying to find a way of assigning the animation &lt;I&gt;directly&lt;/I&gt; to the Foreground Color of the button (or the Button.Content Color or various other permutations - none of which worked).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;The reason is that you have to set the animation on a &lt;I&gt;Brush&lt;/I&gt;, and not directly to the Foreground property. You then assign this brush as the one to be used for the Foreground. And finally, when you run the animation to change the color of the brush, the animation is then seen to be applied to the Foreground. I hope that makes sense!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Here's the VB code that does this:&lt;/P&gt;
&lt;P&gt;
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 10pt"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Times New Roman'; BACKGROUND-COLOR: #f5f8d6"&gt;&lt;FONT color=#008000&gt;' Create color animation sequence.&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;Dim&lt;/FONT&gt; blackToWhite&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; ColorAnimation =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; ColorAnimation(Colors.White,&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; Duration(&lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; TimeSpan(0, 0, 2)))&lt;BR&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;'Create a new brush and apply the color animation to the brush&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;Dim&lt;/FONT&gt; scb&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; SolidColorBrush =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; SolidColorBrush(Colors.Black)&lt;BR&gt;&lt;BR&gt;scb.BeginAnimation(SolidColorBrush.ColorProperty, blackToWhite)&lt;BR&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;'Assign the brush to Button's Foreground&lt;/FONT&gt;&lt;BR&gt;Button1.Foreground = scb&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Like all these little glitches and gotchas, you wonder how it seemed so difficult once you've seen the answer. But as we all know, it's really easy to set yourself off on the wrong mindset and find yourself needlessly chasing your tail trying to get the exact syntax for what you're trying to achieve. Hopefully if you need to run this kind of animation in code, you'll now be saved a bit of potential frustration. &lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/9058.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>Applications = Code + Markup : VB.NET Code Samples     </title><link>http://blogs.vbcity.com/xtab/archive/2008/03/09/8997.aspx</link><pubDate>Sun, 09 Mar 2008 11:43:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2008/03/09/8997.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/8997.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2008/03/09/8997.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/8997.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/8997.aspx</trackback:ping><description>&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&amp;nbsp;I've been working in conjunction with Evan Lim and Young Joo to convert the source code examples from Charles Petzold into VB.NET. As at today there still doesn't seem to be a WPF book on the market that has&amp;nbsp; VB.NET as the code-behind (although I know there are a couple on the way). Add to this the fact that many C# to VB converters at the moment still get it wrong with several areas of the new Framework, this is a real stumbling block&amp;nbsp;for many VB developers who would otherwise be much more interested in digging into WPF. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&amp;nbsp;The link to the final version of the conversion of Petzold samples is &lt;A href="http://blogs.msdn.com/vbteam/pages/Petzold-WPF-VB-Samples.aspx "&gt;&lt;STRONG&gt;here&lt;/STRONG&gt;&lt;/A&gt;. You can download individual chapter code or the whole shebang from the links in that blog item&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&amp;nbsp;I've just started working on a similar project to convert the C# code of another WPF book. I'll post more once I've got something to show. In the meantime I hope that the Matthew McDonald and Billy Hollis WPF/VB books will be on the shelves before long.&lt;/FONT&gt;&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8997.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>WPF Basics: Video Demonstration - Creating A Simple ControlTemplate</title><link>http://blogs.vbcity.com/xtab/archive/2008/02/03/8968.aspx</link><pubDate>Sun, 03 Feb 2008 20:08:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2008/02/03/8968.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/8968.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2008/02/03/8968.aspx#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/8968.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/8968.aspx</trackback:ping><description>&lt;FONT face=Verdana size=2&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/VideoTutorials/cs_logo.gif"&gt;   I've had a copy of the excellent Camtasia Studio from TechSmith on my system for a while now and I've been itching to find time to create a video demo or two. &lt;BR&gt;&lt;BR&gt;&lt;BR&gt;   Just as everyone warned me it would be, it's a lot harder and takes wa-ay longer than you think it will, but my first effort is finally finished.&lt;/P&gt;
&lt;P&gt;  As you can see from the blog heading, the video is a mini-tutorial on the subject of how to create a simple ControlTemplate in WPF.   The example I've used is a round button, just to show the techniques rather than try and get too fancy with the design.&lt;BR&gt;&lt;BR&gt;    It's 99.9%  XAML; just one tiny bit of VB used to demonstrate that the templated button is wired up to the standard button Click event.&lt;/P&gt;
&lt;P&gt;   The full-length video runs to just over 12 minutes and you can access it from &lt;A href="http://www.xtabvbcity.plus.com/VideoTutorials/WPFControlTemplate.wmv"&gt;HERE &lt;BR&gt;&lt;/A&gt;&lt;BR&gt;or download a zipped copy &lt;A href="http://www.xtabvbcity.plus.com/VideoTutorials/WPFControlTemplate.zip"&gt;HERE&lt;/A&gt; &lt;BR&gt;&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/VideoTutorials/silverlight_logo_small.gif"&gt; &lt;BR&gt;&lt;/P&gt;
&lt;P&gt;  In addition, I was greatly encouraged by Karl Shifflett's &lt;A href="http://www.codeproject.com/KB/scrapbook/HowToCreateArticleVideos.aspx"&gt;clear and comprehensive article &lt;/A&gt;(not forgetting his demo videos!) on CodeProject  to try and create a Silverlight version too. In order to keep within the bandwidth limitations, I've had to break the original demo into two parts.&lt;/P&gt;
&lt;P&gt;  You can view the same video streamed as a Silverlight application from the links below:&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;A href="http://silverlight.services.live.com/invoke/49907/ControlTemplates1/iframe.html" target=_blank&gt;WPF ControlTemplate Part 1 Video&lt;/A&gt; &lt;BR&gt;&lt;BR&gt;&lt;A href="http://silverlight.services.live.com/invoke/49907/ControlTemplates2/iframe.html" target=_blank&gt;WPF ControlTemplate Part 2 Video&lt;/A&gt; &lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;  If you want to view the Silverlight versions full screen, select the button shown in the image below for Full Screen and the Esc key to return to Default Size&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/VideoTutorials/videoplayercontrols.jpg"&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8968.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>WPF Basics:  Change A ListBoxItem's Foreground Color When Value Changes</title><link>http://blogs.vbcity.com/xtab/archive/2008/02/01/8967.aspx</link><pubDate>Fri, 01 Feb 2008 13:31:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2008/02/01/8967.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/8967.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2008/02/01/8967.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/8967.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/8967.aspx</trackback:ping><description>&lt;FONT face=verdana size=2&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Quite often as I browse through the VB.NET Forums on vbCity I see questions about tasks that can be quite difficult in WinForms, but would be much easier to deal with using WPF. One recent question that fits this description is the following one: &lt;/P&gt;
&lt;TABLE borderColor=#000000 width="100%" bgColor=#ccffff&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;&lt;FONT face="MS Sans Serif" color=#666699 size=3&gt;"I am wondering how I can change a specific line of text in a listbox based on a condition. &lt;BR&gt;&lt;BR&gt;For example, if I subract listbox.items.item(1) from listbox.items.item(0) and the posted result in position (2) is a negative decimal then make item(2) red.. or if the result is greater than 1000 then turn it green. &lt;BR&gt;&lt;BR&gt;I tried some of the examples in some other posts, but they aren't what I am looking for. &lt;BR&gt;&lt;BR&gt;Any help would be appreciated. &lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;As you can see, essentially this is a task where a ListBox contains some items that represent numeric values. Some simple arithmetic is used to calculate the value for the third line. The color of the text on that line is decided depending on whether the value is negative or higher than 1000. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;In Windows Forms this job would need the use of OwnerDraw in the ListBox, with each line being drawn using the GDI+ DrawString method. While not that daunting a task, OwnerDraw and DrawString can get a bit unwieldy if you have a lot of data to handle. So, even though OwnerDraw would probably be fine for this particular example, I still thought it was worth seeing how WPF might be used to deal with it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;With my WPF head on, I first thought that I would tackle this with a value converter using IValueConverter, reading the values and setting the Brush color based on the value. But as it turns out, WPF's innate ability to accept varying settings for each individual ListBoxItem's Foreground property made it a much easier proposition. &lt;/P&gt;
&lt;P&gt;&lt;U&gt;The Basics&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Because I'm concentrating on the UI here, not the mechanics of how to get the values, I've short-circuited this part and simply hard-coded the values into the ListBox. (Don't worry, I'll get to how you can take values from the user, insert them into the ListBox and do the arithmetic at the end, if that's something you need.) &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Here's the Xaml to create the ListBox and those three items:&lt;/P&gt;
&lt;P&gt;
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 10pt"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #eeeeee"&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;="BasicTask"&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xmlns&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;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;BR&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Title&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="BasicTask"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Height&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="300"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Width&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="300"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBox&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Margin&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="79,38,79,65"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="ListBox1"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; FontSize&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="20"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&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;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Value1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;2000&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Value2"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;3000&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Value3"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;-1000&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBox&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;BR&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;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;(I've manually done the arithmetic which is very unrealistic, but keeps the code to a minimum for now)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Of the various ways of tackling this, I decided to use a simple Select Case block in the Code-Behind. The ListBox control has a LayoutUpdated event, which fires whenever there is a change to the layout of the visual elements of the control. We can use this event to apply the appropriate colors to the text items. &lt;/P&gt;
&lt;P&gt;
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 10pt"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #eeeeee"&gt;&lt;FONT color=#0000ff&gt;Partial&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Public&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Class&lt;/FONT&gt; BasicTask&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Private&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt; ListBox1_LayoutUpdated(&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.EventArgs)&lt;FONT color=#0000ff&gt; Handles&lt;/FONT&gt; ListBox1.LayoutUpdated&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Select&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; CDbl&lt;/FONT&gt;(Value3.Content)&lt;BR&gt;&lt;FONT color=#0000ff&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;Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Is&lt;/FONT&gt; &amp;lt; 0&lt;BR&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;Value3.Foreground = Brushes.Red&lt;BR&gt;&lt;FONT color=#0000ff&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;Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Is&lt;/FONT&gt; &amp;gt; 1000&lt;BR&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;Value3.Foreground = Brushes.DarkSeaGreen&lt;BR&gt;&lt;FONT color=#0000ff&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;Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Else&lt;/FONT&gt;&lt;BR&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;Value3.Foreground = Brushes.Black&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Select&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;BR&gt;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Class&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/ListBox1.jpg"&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; So if you already have a ListBox with values in it, that's all the code you need. It's quicker and cleaner than the OwnerDraw route, I think you'll agree. &lt;/P&gt;
&lt;P&gt;&lt;U&gt;Taking User Input&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;As hard-coding those values in the Xaml isn't very realistic, as promised earlier, here is one way to create the ListBox in Xaml and update it in code:&lt;/P&gt;
&lt;P&gt;
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 10pt"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #eeeeee"&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&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;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Button&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Height&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="23"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; HorizontalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Left"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Margin&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="22,91,0,0"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Button1"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; VerticalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Top"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Width&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="75"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Enter&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Button&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TextBox&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Height&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="23"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Margin&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="22,34,0,0"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="TextBox1"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; VerticalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Top"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; HorizontalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Left"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Width&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="84"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;2500&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TextBox&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TextBox&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Height&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="23"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Margin&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="0,34,31,0"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="TextBox2"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; VerticalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Top"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; HorizontalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Right"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Width&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="90"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;900&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TextBox&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Label&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Height&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="28"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; HorizontalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Left"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Margin&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="22,0,0,0"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Label1"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; VerticalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Top"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Width&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="96"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;First Value&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Label&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Label&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Height&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="28"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; HorizontalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Right"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Margin&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="0,0,25,0"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Label2"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; VerticalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Top"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Width&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="96"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Second Value&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Label&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBox&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Margin&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="0,91,31,33"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="ListBox1"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; FontSize&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="20"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; HorizontalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Right"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Width&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="120"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&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;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Value1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;0&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Value2"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;0&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Value3"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;0&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBox&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;Grid&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 10pt"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #eeeeee"&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Private&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt; Button1_Click(&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; Button1.Click&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Value1.Content = TextBox1.Text&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Value2.Content = TextBox2.Text&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Value3.Content = (&lt;FONT color=#0000ff&gt;CDbl&lt;/FONT&gt;(TextBox1.Text) -&lt;FONT color=#0000ff&gt; CDbl&lt;/FONT&gt;(TextBox2.Text)).ToString&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Private&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt; ListBox1_LayoutUpdated(&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.EventArgs)&lt;FONT color=#0000ff&gt; Handles&lt;/FONT&gt; ListBox1.LayoutUpdated&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Select&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; CDbl&lt;/FONT&gt;(Value3.Content)&lt;BR&gt;&lt;FONT color=#0000ff&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;Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Is&lt;/FONT&gt; &amp;lt; 0&lt;BR&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;Value3.Foreground = Brushes.Red&lt;BR&gt;&lt;FONT color=#0000ff&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;Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Is&lt;/FONT&gt; &amp;gt; 1000&lt;BR&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;Value3.Foreground = Brushes.DarkSeaGreen&lt;BR&gt;&lt;FONT color=#0000ff&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;Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Else&lt;/FONT&gt;&lt;BR&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;Value3.Foreground = Brushes.Black&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Select&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;The result will look something like this &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/ListBox2.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;As you change the values in the two TextBoxes, the ListBox will update and the text color of the third item will reflect the rules in the LayoutUpdated event.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Because the scenario has a preset configuration of just those three items, the above approach is the easiest. &lt;/P&gt;
&lt;P&gt;&lt;U&gt;Varying Number of ListBoxItems&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;If for some reason you can't or don't want to create the three ListBoxItems in Xaml, then you can easily (if slightly more verbosely) do this in the code-behind: &lt;/P&gt;
&lt;P&gt;
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 10pt"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #eeeeee"&gt;&lt;FONT color=#0000ff&gt;Private&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt; Button1_Click(&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; Button1.Click&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ListBox1.Items.Clear()&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim&lt;/FONT&gt; lbi&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; ListBoxItem&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lbi.Content = TextBox1.Text&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ListBox1.Items.Add(lbi)&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lbi =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; ListBoxItem&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lbi.Content = TextBox2.Text&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ListBox1.Items.Add(lbi)&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lbi =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; ListBoxItem&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lbi.Content = (&lt;FONT color=#0000ff&gt;CDbl&lt;/FONT&gt;(TextBox1.Text) -&lt;FONT color=#0000ff&gt; CDbl&lt;/FONT&gt;(TextBox2.Text)).ToString&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ListBox1.Items.Add(lbi)&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim&lt;/FONT&gt; item3&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; ListBoxItem&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;item3 =&lt;FONT color=#0000ff&gt; CType&lt;/FONT&gt;(ListBox1.Items(2), ListBoxItem)&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Select&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; CDbl&lt;/FONT&gt;(item3.Content)&lt;BR&gt;&lt;FONT color=#0000ff&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;Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Is&lt;/FONT&gt; &amp;lt; 0&lt;BR&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;item3.Foreground = Brushes.Red&lt;BR&gt;&lt;FONT color=#0000ff&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;Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Is&lt;/FONT&gt; &amp;gt; 1000&lt;BR&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;item3.Foreground = Brushes.DarkSeaGreen&lt;BR&gt;&lt;FONT color=#0000ff&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;Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Else&lt;/FONT&gt;&lt;BR&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;item3.Foreground = Brushes.Black&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Select&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;You can of course vary the number of ListBoxItems added in this way and select another of them for the text color formatting treatment. You'll see that I put all the code in the Button click this time. If you're wondering why, it's because the LayoutUpdated event fires when the ListBox is first created. As there are no ListBoxItems in existence at that moment, you will get an exception when you try and access the non-existent ListBox1.Items(2) item. &lt;/P&gt;
&lt;P&gt;&lt;U&gt;And Finally ....&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Although it's not part of the original question, you might at some time want to comb through a ListBox like this and change the color of &lt;I&gt;all&lt;/I&gt; the lines that meet our criteria of less than zero or more than 1000. Enumerating through the ListBoxItems will do this job for you:&lt;/P&gt;
&lt;P&gt;
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 10pt"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #eeeeee"&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;Private&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt; ListBox1_LayoutUpdated(&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.EventArgs)&lt;FONT color=#0000ff&gt; Handles&lt;/FONT&gt; ListBox1.LayoutUpdated&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;For&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Each&lt;/FONT&gt; l&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; ListBoxItem&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Me&lt;/FONT&gt;.ListBox1.Items&lt;BR&gt;&lt;FONT color=#0000ff&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;Select&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; CDbl&lt;/FONT&gt;(l.Content)&lt;BR&gt;&lt;FONT color=#0000ff&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;Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Is&lt;/FONT&gt; &amp;lt; 0&lt;BR&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;l.Foreground = Brushes.Red&lt;BR&gt;&lt;FONT color=#0000ff&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;Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Is&lt;/FONT&gt; &amp;gt; 1000&lt;BR&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;l.Foreground = Brushes.DarkSeaGreen&lt;BR&gt;&lt;FONT color=#0000ff&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;Case&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Else&lt;/FONT&gt;&lt;BR&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;l.Foreground = Brushes.Black&lt;BR&gt;&lt;FONT color=#0000ff&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;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Select&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Next&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;And as a final thought, if you only want to turn text Red if the value is below zero and leave it as Black for all other values then you can replace that multi line Select Case block with a single line IIF statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;For completeness, all the above samples should have some validation added to ensure that the items exist and that the text represents valid numeric values.&lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8967.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>First Chance Exception and XamlParseException</title><link>http://blogs.vbcity.com/xtab/archive/2008/02/01/8966.aspx</link><pubDate>Fri, 01 Feb 2008 11:44:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2008/02/01/8966.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/8966.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2008/02/01/8966.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/8966.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/8966.aspx</trackback:ping><description>&lt;FONT face=verdana size=2&gt;
&lt;P&gt;&lt;U&gt;First Chance Exceptions&lt;/U&gt;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;I suspect that most of us have become so used to seeing the message that reads:- &lt;BR&gt;&lt;BR&gt;&lt;FONT face="courier new"&gt;" A first chance exception of type 'System.ApplicationException' occurred in WindowsApplication1.exe " &lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;that it hardly hits our conscious thoughts any more.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;But did you ever check out just what this message really means or wonder whether you should or could do anything about it ? &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;I suppose the first thing you need to know in order to answer those questions is just exactly what a First Chance Exception &lt;EM&gt;is&lt;/EM&gt;. Well, in it's simplest terms it's a mechanism that flags up that there is a possible error condition. The key point here though is that this flagging up takes place in the &lt;I&gt;Debugger&lt;/I&gt; and not in the running application itself. (We probably often think of the two as being the same thing, but in fact that's not really the case).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;When the Debugger detects an Exception situation it raises a First Chance Exception. In several situations it isn't always desirable for the program to come to a grinding halt each time. And of course, being a skilled developer, you will have built appropriate Try Catch exception handling blocks into the code which will sort the problem anyway! So, depending on the Debugging settings you have laid down (more on this later), the Debugger allows this First Chance Exception to pass and the program continues to run. &lt;/P&gt;
&lt;P&gt;&lt;U&gt;Second Chance Exceptions&lt;/U&gt;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; At this point, where the &lt;I&gt;running program&lt;/I&gt; now has to deal with the Exception situation, the application will either handle the Exception or not handle it (your Structured Exception Handling code coming in to play here). If it does handle it, then the application will of course be allowed to proceed and it will happily keep running until the next problem is encountered or the application ends. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;If the program fails to deal with the Exception at this point, the Debugger is notified again of this unhandled error situation - and this is now the Second Chance Exception level. Hitting this point will result in the kind of Unhandled Exception Message Box that I know you will have seen many, many times: &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/ErrorMessage.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;An Exceptional Situation - XamlParseException&lt;/U&gt;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;Although I'd never really given it much thought I guess I'd always assumed that by default the settings in Visual Studio were such that all First Chance Exceptions were allowed through to the program as described above. With some timely assistance from the Microsoft Visual Basic team, I discovered recently that this is not the case. There is one Exception which by default is set to Throw on a First Chance Exception - and that is the XamlParseException. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; When I say "by default" I'll have to qualify that slightly. I'm not sure that it is set by default in &lt;I&gt;every&lt;/I&gt; kind of installation of Visual Studio 2008, but certainly in the Pro and Express Editions if you have set the Profile to Visual Basic developer settings then this will be the case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;As a result I spent quite a long time struggling with a particular project that had to deal with many situations where the Xaml at certain points in time was not valid and so would not parse. Even though I had built in a Try Catch block for this Exception, the program would never reach that exception handler because the Debugger would throw the Exception at the first chance stage.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;The route to finding this setting in the IDE is as follows:&lt;BR&gt;&lt;BR&gt;Select Debug &amp;gt; Exceptions &lt;BR&gt;then in the Window that appears, choose "Common language Runtime Exceptions" and expand the list. &lt;BR&gt;Navigate down the list until you reach "System.Windows.Markup". &lt;BR&gt;Next click on the plus symbol to show the Exceptions in this class. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;(Alternatively you can click the "Find..." button and enter the name of the Exception).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;You can see in the screenshot below that the "Thrown" checkbox is checked:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/XamlParseException.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;which is of course the reason why my project was stopping in Debug mode whenever it first hit a XamlParseException.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;If you want your code to be allowed to handle this kind of Exception (as I did) then of course you just need to uncheck that box.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;I did a quick sweep of all the settings for all Exceptions and that XamlParseException seems to be the only one that is checked by default. But if you should come across a similar puzzling situation yourself in the future, you should probably think of those Exception settings as one of the places you should first look.&lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8966.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>WPF Basics: Expression Blend and Visual Studio - a Good  Partnership</title><link>http://blogs.vbcity.com/xtab/archive/2008/01/20/8954.aspx</link><pubDate>Sun, 20 Jan 2008 20:42:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2008/01/20/8954.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/8954.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2008/01/20/8954.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/8954.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/8954.aspx</trackback:ping><description>&lt;FONT face=verdana size=2&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; I've been experimenting with the interaction between Visual Studio 2008 and Expression Blend (Version 1 with SP1). One thing I realised early on (right from the Orcas Beta days) is that Blend is a great help when you want to fine tune color gradients, create lines, shapes and paths or create animations. Having carried out both of these tasks by typing in the Xaml code in Visual Studio and checking the result, it's not something I'd want to do the hard way long term. &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;That said, I'm surprised at just how comfortable I am now with manually entering xaml in Visual Studio for the mainstream tasks&amp;nbsp;- probably because this is the way I started. In fact, because the early Beta designer had poor toolbox functionality I still often prefer to type xaml, rather than drag an instance from the toolbox. (I'm sure I'll get lazier as time goes on, though!). &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp; I didn't find Blend very intuitive at first (and positively hated the default "Expression Dark" setting). But I'm beginning to find that I'm using the Properties and Interaction Panels much more now, so I suppose it's just another learning curve to navigate. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Anyway, back to the interaction between the two products. If you open up the same project in both Blend and Visual Studio at the same time you can flip back and forth between the two. Whenever you save file(s) in either application, you'll be invited to update the modified project as soon as you switch to the other app. Note that the files have to be saved, not just amended, for this to happen. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; I made a couple of wrong assumptions at first. One thing I did wrong was to open up individual xaml files from an existing project in Blend to work on them (i.e I opened a new Blend project and added an existing file to that). Of course, the only sensible way is to open the containing Project, even if you aren't currently interested in working with it in Visual Studio. &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;You can make changes (if you want to) to any of the xaml files inside Blend, save the file(s) and exit. The next time you do open up this project in Visual Studio, the changes will be incorporated (naturally, because it's the same files!) but you won't get any notification that changes have been made. The same applies in reverse. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;It's possible that you might be tempted to select a .vb or .cs file, right click and select "Edit Externally" from the Context Menu, or double click the file name. And if you did this, you might expect to be taken to the Visual Studio instance that's currently running this project. Actually what does happen is that a new instance of Visual Studio will open with just that single code-behind file in the IDE. So of course most times you'll just Alt-TAB between applications or use the Windows Taskbar. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/EditExternally.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;On the subject of editing externally, you'll absolutely want to stick with Visual Studio for most of your xaml editing. Blend offers you no Intellisense help at all in the current version; VS Intellisense is very smart and helpful. If you choose the 'Edit Externally' option in Blend, you'll be taken to Notepad by default, which isn't a whole lot better than the xaml window in Blend itself. It may be possible to tweak this setting to some other xaml code editor such as XamlPad, but it's hard to see any reason not to use Visual Studio if you have it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;So essentially my experience so far is that the best way is to open the same project side by side (literally in my case as I now use two monitors), use Visual Studio for most of the hand-built xaml (plus the code-behind of course) and use Blend for the purely visual touches that are difficult to visualize and/or verbose to write. If V2 of Blend includes Intellisense that might change but for now that's the approach that works best for me.&lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8954.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>WPF Basics:  How To Add Controls Dynamically at Run Time</title><link>http://blogs.vbcity.com/xtab/archive/2008/01/15/8949.aspx</link><pubDate>Tue, 15 Jan 2008 18:17:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2008/01/15/8949.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/8949.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2008/01/15/8949.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/8949.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/8949.aspx</trackback:ping><description>&lt;FONT face=verdana size=2&gt;
&lt;P&gt;   Adding controls at run time using VB.NET in Windows Forms is fairly well-documented. Finding C# code-behind samples for doing this with WPF controls under Framework 3.0 is also an easy task. &lt;BR&gt;But I recently wanted to see how to do this with a WPF application in Visual Basic 2008 and I found that at the time of writing my searches produced no useful clear "How To" results.&lt;/P&gt;
&lt;P&gt;   Direct conversion from C# to VB using the current conversion tools didn't always identify some essential code elements, resulting in quite a frustrating time spent finding the correct way of doing this. (Not an unusual scenario nowadays, as more and more samples - including too many MSDN ones - seem to have only C# samples available). &lt;/P&gt;
&lt;P&gt;  Along the way I also discovered that not everything is as it seems - apparently difficult things were easy; things that seemed they should be easy turned out to be more difficult. &lt;BR&gt;And of course as is often the case it turns out that there is more than one way to do most things. &lt;/P&gt;
&lt;P&gt;   Once you have solved the puzzles it all seems easy, but I thought I'd save you the trouble of having to work out the steps involved if you should need to do this before better Visual Basic documentation becomes available. &lt;/P&gt;
&lt;P&gt;  You can link to the first page of my &lt;A href="http://www.xtabvbcity.plus.com/Articles/WPFDynamicControls1/WPFDynamicControls1_Page1.htm"&gt;article here&lt;/A&gt;.&lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8949.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>Changing The Background Color of a TabControl's Tab</title><link>http://blogs.vbcity.com/xtab/archive/2008/01/14/8945.aspx</link><pubDate>Mon, 14 Jan 2008 14:27:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2008/01/14/8945.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/8945.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2008/01/14/8945.aspx#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/8945.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/8945.aspx</trackback:ping><description>&lt;FONT face=Verdana size=2&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;I've noticed a couple of questions in the VB.NET forums recently where someone wants to change the BackColor of the Tab Header on TabPages. As far as I know, in VB2005 and earlier you have to either use OwnerDraw techniques or subclass your own version of a TabControl. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; In VB2008, WPF offers a much easier route. The equivalent element to a TabPage in Windows Forms is the TabItem in WPF. The WPF TabItem actually has its own Background and Foreground properties, each of which will be applied to the Header Tab. &lt;BR&gt;&lt;BR&gt;Of course you can also set the Background color of the main TabItem page itself via panel type controls with their own Backgrounds set as required. The ListBox in the screenshot demonstrates this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;The following sample is a very basic example of doing this.&lt;/P&gt;
&lt;P&gt;
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 10pt"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #eaeaea"&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabControl&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Margin&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="8"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="TabControl1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&amp;nbsp;Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Members"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Background&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="LightGreen"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Foreground&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Navy"&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBox&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Width&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="150"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Background&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="LightGreen"&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#ff0000&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;HorizontalAlignment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Left"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&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;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;J Smith&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;J Jones&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;C B Travis&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;L Fourleather&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBox&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Background&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Green"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Associates"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Foreground&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Navy" &amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Background&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="LightBlue"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&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;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;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&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;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;StackPanel&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;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&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;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Image&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Width&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="20"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Source&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="CLUB.BMP"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&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;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TextBlock&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Text&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="&amp;nbsp;&amp;nbsp;&amp;nbsp;Sponsors"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Foreground&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Red"/&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&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;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;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&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;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;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&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;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;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&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;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBox&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;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;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;J Smith&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;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;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;J Jones&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;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;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;C B Travis&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;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;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;L Fourleather&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBoxItem&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;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;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;ListBox&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;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;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;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&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;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;BR&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;The result looks like this: &lt;BR&gt;&lt;BR&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/TabItemDemo.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;One thing to note is that by default the Header will revert to a White background when it has focus (as shown in the above screenshot). A side effect of this is that you have to be aware that your Foreground will also need to be such that it is visible on both a white background as well as the one you set. To change this behaviour you will probably have to apply a Style or use a ControlTemplate. I haven't fully researched this yet, but plan to write a full article on TabControls and these little tips and tricks in the very near future. But in the meantime if all you need is a more colorful set of headers then WPF supplies the easy answer.&lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8945.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>WPF DockPanel.Dock Problem</title><link>http://blogs.vbcity.com/xtab/archive/2008/01/10/8939.aspx</link><pubDate>Thu, 10 Jan 2008 12:35:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2008/01/10/8939.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/8939.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2008/01/10/8939.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/8939.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/8939.aspx</trackback:ping><description>&lt;FONT face=verdana size=2&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;If you regularly read my blog you'll know that I like to flag up those silly little Gotchas that are minor in themselves, but massively frustrating when you come upon them and can't see the cause or the way through. &amp;nbsp;I was working on a project last night and got stuck on something that had me bamboozled for a while. &amp;nbsp; What made it harder to figure out was that I knew I had successfully achieved the result I wanted many times in the past without any problem. &amp;nbsp; Was it me? Or bad syntax (but not spotted by the syntax editor)? Or some bug in the VB2008 installation on this particular machine? &lt;BR&gt;Of course, as usual, it was none of those things. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;So, here's the scenario: I had a DockPanel inside a Grid. Inside the DockPanel I wanted to dock a button to the Right side of the DockPanel. Easy Enough? Of course. Just set the attached DockPanel.Dock Property to Right and it should obediently move itself over to the right.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/DockPanelProblem1.jpg"&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;The culprit is in fact the LastChildFill property of the DockPanel. It turns out that by default this is set to True. (I struggle to see the logic of this and would have preferred to see its default as False, but such is life). So what is happening (kinda) is that the button - being the "last item" - is set to fill the DockPanel. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Did you notice that the button has values set for its Height and Width properties? This is significant because it explains why the button remains resolutely in the centre of the panel. &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/DockPanelProblem2.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;So, what's happening here is that the DockPanel tries to use the "last child", the button - which is of course the only child - to totally fill the DockPanel area. But, because the button only wants itself to have a limit of 23 on its height and 75 on its width, the button has the last word on the matter. Therefore the DockPanel places the button in its centre and begins to stretch it outwards. When it hits the limit imposed by the button it stops stretching it. Logical really and actually is exactly what you would want. If you've set a value on height and width you would expect the project to honour it. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;The fix as usual is simple. Change the DockPanel's LastChildFill property to False and all the elements can be laid out as requested: The button has its required height and width and the DockPanel is able to allow it to dock to the right.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/DockPanelProblem3.jpg"&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8939.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>Developer Day Scotland 2008</title><link>http://blogs.vbcity.com/xtab/archive/2007/12/21/8925.aspx</link><pubDate>Fri, 21 Dec 2007 10:28:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2007/12/21/8925.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/8925.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2007/12/21/8925.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/8925.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/8925.aspx</trackback:ping><description>&lt;P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align=center&gt;&lt;A href="http://developerdayscotland.com/main/Default.aspx"&gt;&lt;IMG height=192 alt="Developer Day Scotland" src="http://developerdayscotland.com/images/badges/GetReady1-medium.png" width=144 border=0&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P align=center&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp; It's been a long time in the planning, but it's great to see that Developer Day Scotland is now off the ground and will be held in Glasgow on 10th May 2008.&amp;nbsp;&amp;nbsp; This event is based on the highly successful "Developer! Developer!&amp;nbsp; Developer!"&amp;nbsp; series of one day events that have been run in Reading over the past few years.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp; You can get all the up to date info on the event by clicking on the image above.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&amp;nbsp; There has been a lot of interest already and I'm sure it will follow the example of other DDDs and be fully booked up within days of registration opening.&amp;nbsp;&amp;nbsp; So watch out for that announcement if you live in the top half of the UK and want to attend this free event.&lt;/FONT&gt;&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8925.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>