<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>David Wetzel's Blog</title>
	<atom:link href="http://davidwetzel.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidwetzel.wordpress.com</link>
	<description>WPF / Silverlight Blog</description>
	<lastBuildDate>Fri, 09 Oct 2009 01:28:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='davidwetzel.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>David Wetzel's Blog</title>
		<link>http://davidwetzel.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://davidwetzel.wordpress.com/osd.xml" title="David Wetzel&#039;s Blog" />
	<atom:link rel='hub' href='http://davidwetzel.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Source Code &amp; PowerPoint from Seminar</title>
		<link>http://davidwetzel.wordpress.com/2009/10/08/source-code-powerpoint-from-seminar/</link>
		<comments>http://davidwetzel.wordpress.com/2009/10/08/source-code-powerpoint-from-seminar/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 01:28:19 +0000</pubDate>
		<dc:creator>David Wetzel</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://davidwetzel.wordpress.com/?p=22</guid>
		<description><![CDATA[I have the source code and the PowerPoint that I used during my seminar.  You can download it from my main blog site: http://blogs.windowsclient.net/airborneengineer/archive/2009/10/08/source-amp-powerpoint-from-seminar.aspx Posted in Uncategorized<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davidwetzel.wordpress.com&amp;blog=6706790&amp;post=22&amp;subd=davidwetzel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have the source code and the PowerPoint that I used during my seminar.  You can download it from my main blog site:</p>
<p><a href="http://blogs.windowsclient.net/airborneengineer/archive/2009/10/08/source-amp-powerpoint-from-seminar.aspx">http://blogs.windowsclient.net/airborneengineer/archive/2009/10/08/source-amp-powerpoint-from-seminar.aspx</a><a title="Read rest here..." href="http://blogs.windowsclient.net/airborneengineer/default.aspx" target="_self"></a></p>
<br />Posted in Uncategorized  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwetzel.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwetzel.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwetzel.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwetzel.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/davidwetzel.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/davidwetzel.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/davidwetzel.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/davidwetzel.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwetzel.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwetzel.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwetzel.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwetzel.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwetzel.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwetzel.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davidwetzel.wordpress.com&amp;blog=6706790&amp;post=22&amp;subd=davidwetzel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davidwetzel.wordpress.com/2009/10/08/source-code-powerpoint-from-seminar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f69c61cdaaf9953fab3c41fae59ddfec?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">David Wetzel</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Silverlight &amp; WCF Seminar</title>
		<link>http://davidwetzel.wordpress.com/2009/09/09/using-silverlight-wcf-seminar/</link>
		<comments>http://davidwetzel.wordpress.com/2009/09/09/using-silverlight-wcf-seminar/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 01:06:29 +0000</pubDate>
		<dc:creator>David Wetzel</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://davidwetzel.wordpress.com/?p=19</guid>
		<description><![CDATA[I have a confirmed date and place for my next lecture.  I will be presenting a seminar on using Silverlight and WCF.  This will tutorial rather than just the technologies capabilities.  October 6th at 6:00 PM (food &#38; drinks are served starting @ 5:00).  Location: SpringHill Suites by Marriott 2437 Metrocentre Blvd. West Palm Beach, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davidwetzel.wordpress.com&amp;blog=6706790&amp;post=19&amp;subd=davidwetzel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have a confirmed date and place for my next lecture.  I will be presenting a seminar on using Silverlight and WCF.  This will tutorial rather than just the technologies capabilities. </p>
<p>October 6<sup>th</sup> at 6:00 PM (food &amp; drinks are served starting @ 5:00). </p>
<p>Location:</p>
<p>SpringHill Suites by Marriott<br />
2437 Metrocentre Blvd.<br />
West Palm Beach, FL 33407</p>
<p>Hope to see you there.</p>
<br />Posted in Uncategorized  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwetzel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwetzel.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwetzel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwetzel.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/davidwetzel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/davidwetzel.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/davidwetzel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/davidwetzel.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwetzel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwetzel.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwetzel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwetzel.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwetzel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwetzel.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davidwetzel.wordpress.com&amp;blog=6706790&amp;post=19&amp;subd=davidwetzel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davidwetzel.wordpress.com/2009/09/09/using-silverlight-wcf-seminar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f69c61cdaaf9953fab3c41fae59ddfec?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">David Wetzel</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF Styles and Templates – Part II (ComboBox Customization)</title>
		<link>http://davidwetzel.wordpress.com/2009/06/25/wpf-styles-and-templates-%e2%80%93-part-ii-combobox-customization/</link>
		<comments>http://davidwetzel.wordpress.com/2009/06/25/wpf-styles-and-templates-%e2%80%93-part-ii-combobox-customization/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 16:08:15 +0000</pubDate>
		<dc:creator>David Wetzel</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://davidwetzel.wordpress.com/?p=17</guid>
		<description><![CDATA[This is the second part of my article on customizing controls in WPF. If you have not read the first part and are not familiar with Styles you may want to read part I http://windowsclient.net/blogs/airborneengineer/archive/2009/06/09/wpf-styles-and-templates-part-i.aspx . In this article we will focus on ComboBoxes. We make a ComboBox that is capable of displaying an Image [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davidwetzel.wordpress.com&amp;blog=6706790&amp;post=17&amp;subd=davidwetzel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is the second part of my article on customizing controls in WPF. If you have not read the first part and are not familiar with Styles you may want to read part I <a href="http://windowsclient.net/blogs/airborneengineer/archive/2009/06/09/wpf-styles-and-templates-part-i.aspx">http://windowsclient.net/blogs/airborneengineer/archive/2009/06/09/wpf-styles-and-templates-part-i.aspx</a> . In this article we will focus on ComboBoxes. We make a ComboBox that is capable of displaying an Image and Text and also show how binding works when storing classes in ComboBoxes.</p>
<p>For the complete article:</p>
<p><a href="http://blogs.windowsclient.net/airborneengineer/archive/2009/06/25/wpf-styles-and-templates-part-ii-combobox-customization.aspx">http://blogs.windowsclient.net/airborneengineer/archive/2009/06/25/wpf-styles-and-templates-part-ii-combobox-customization.aspx</a></p>
<br />Posted in Uncategorized  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwetzel.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwetzel.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwetzel.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwetzel.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/davidwetzel.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/davidwetzel.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/davidwetzel.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/davidwetzel.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwetzel.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwetzel.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwetzel.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwetzel.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwetzel.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwetzel.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davidwetzel.wordpress.com&amp;blog=6706790&amp;post=17&amp;subd=davidwetzel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davidwetzel.wordpress.com/2009/06/25/wpf-styles-and-templates-%e2%80%93-part-ii-combobox-customization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f69c61cdaaf9953fab3c41fae59ddfec?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">David Wetzel</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF Styles and Templates – Part I</title>
		<link>http://davidwetzel.wordpress.com/2009/06/09/wpf-styles-and-templates-%e2%80%93-part-i/</link>
		<comments>http://davidwetzel.wordpress.com/2009/06/09/wpf-styles-and-templates-%e2%80%93-part-i/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 01:06:45 +0000</pubDate>
		<dc:creator>David Wetzel</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[.Net 3.5]]></category>

		<guid isPermaLink="false">http://davidwetzel.wordpress.com/?p=13</guid>
		<description><![CDATA[I originally started out with the intention on describing how to make an image or image and text display in a ComboBox.  As I started writing the article, I realized that instead of making one massive article describing what needs to be done, I would break it down is to functional areas.  – Now, even [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davidwetzel.wordpress.com&amp;blog=6706790&amp;post=13&amp;subd=davidwetzel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I originally started out with the intention on describing how to make an image or image and text display in a ComboBox.  As I started writing the article, I realized that instead of making one massive article describing what needs to be done, I would break it down is to functional areas.  – Now, even blogs need to have design documents.  <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Read the rest of the article on my blog here: </p>
<p><a title="Read rest here..." href="http://blogs.windowsclient.net/airborneengineer/default.aspx" target="_self">http://blogs.windowsclient.net/airborneengineer/default.aspx</a></p>
<br />Posted in C#, Silverlight, WPF Tagged: .Net 3.5, C#, WPF <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwetzel.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwetzel.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwetzel.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwetzel.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/davidwetzel.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/davidwetzel.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/davidwetzel.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/davidwetzel.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwetzel.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwetzel.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwetzel.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwetzel.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwetzel.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwetzel.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davidwetzel.wordpress.com&amp;blog=6706790&amp;post=13&amp;subd=davidwetzel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davidwetzel.wordpress.com/2009/06/09/wpf-styles-and-templates-%e2%80%93-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f69c61cdaaf9953fab3c41fae59ddfec?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">David Wetzel</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF Using WinForms – Wrong Approach</title>
		<link>http://davidwetzel.wordpress.com/2009/03/01/wpf-using-winforms-%e2%80%93-wrong-approach/</link>
		<comments>http://davidwetzel.wordpress.com/2009/03/01/wpf-using-winforms-%e2%80%93-wrong-approach/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 23:31:05 +0000</pubDate>
		<dc:creator>David Wetzel</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://davidwetzel.wordpress.com/?p=10</guid>
		<description><![CDATA[Background It has been quite a while since I have been excited about something new is software development that made me want to spend my off hours playing around with it.  When WPF first came out I did not even give it a look.  I figured it was another one of Microsoft’s attempts to reinvent [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davidwetzel.wordpress.com&amp;blog=6706790&amp;post=10&amp;subd=davidwetzel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Background</h2>
<p>It has been quite a while since I have been excited about something new is software development that made me want to spend my off hours playing around with it.  When WPF first came out I did not even give it a look.  I figured it was another one of Microsoft’s attempts to reinvent something.</p>
<p>I was mainly a middleware developer and wrote WinForms applications to access the middle tier.  I really hated ASP.Net so when I took a contract which required ASP.Net, I was looking around for alternatives and that is when I found Silverlight.  What I liked about Silverlight is it allowed me to create all of the cool functionality that Flash has without having to learn something complete different.  Silverlight was laid out in the same format as the rest of the Microsoft libraries so it just made sense how to wire things up and get up and running.  During my course of learning and playing with Silverlight I found references to WPF and how basic WPF xaml could be used for Silverlight.  I picked up WPF and haven’t looked back.  It does take some time to get used to, when I first started, if I needed to make a quick test harness I used WinForms but now I use WPF for everything.  It takes some time to hit the epiphany where it just all comes into place and makes sense.  When it does, it is really a pleasure to code.</p>
<p>During the last year, I have been given or should I say have had two projects dropped in my lap that were written in WPF (and I use that phrase liberally).  I think the more accurate description is the application was written in WinForms with a xaml front end.  Both applications had one thing in common, they either could not get into QA or could not get out of QA due to performance issues or random exception faults.  After having to basically re-write both applications I made some notes on some of the mistakes I saw in the code with the hope that it will help others who are new to WPF from making the same mistakes.</p>
<h2>User Controls</h2>
<p>When using WinForms, the common approach to have controls have the same look and feel or common functionality is to use user controls.  Though you certainly can do this in WPF, user controls mainly used to encapsulate behavior or group controls together for a specific purpose.  You also have custom controls which basically allows you to build a control from the ground up.  For a good article on user controls vs. custom controls read more here: <a href="http://wangmo.wordpress.com/2007/09/28/user-controls-vs-custom-controls/" target="_blank"><span style="color:#006ff7;">http://wangmo.wordpress.com/2007/09/28/user-controls-vs-custom-controls/</span></a></p>
<p>So if you want to customize the OK and Cancel buttons in your application to have an image with text next to it, instead of creating a user control library which defines this functionality, a style can more easily be defined.  (Style abbreviated for size)</p>
<p><span style="color:#0000ff;">    &lt;Style x:Key=&#8221;ImageButtonStyle&#8221; BasedOn=&#8221;{StaticResource {x:Type Button}}&#8221; TargetType=&#8221;{x:Type Button}&#8221;&gt;<br />
        &lt;Setter Property=&#8221;HorizontalContentAlignment&#8221; Value=&#8221;Center&#8221;/&gt;<br />
        &lt;Setter Property=&#8221;VerticalContentAlignment&#8221; Value=&#8221;Center&#8221;/&gt;<br />
        &lt;Setter Property=&#8221;Template&#8221;&gt;<br />
            &lt;Setter.Value&gt;<br />
                &lt;ControlTemplate TargetType=&#8221;{x:Type Button}&#8221;&gt;<br />
                        &lt;StackPanel&gt;<br />
                            &lt;Image Source=&#8221;{Binding RelativeSource={RelativeSource Self}, Path=DataContext}&#8221; Stretch=&#8221;Fill&#8221; Width=&#8221;45&#8243; Height=&#8221;45&#8243; /&gt; </span></p>
<p><span style="color:#0000ff;">                            &lt;ContentPresenter HorizontalAlignment=&#8221;{TemplateBinding HorizontalContentAlignment}&#8221; Margin=&#8221;{TemplateBinding Padding}&#8221; VerticalAlignment=&#8221;{TemplateBinding VerticalContentAlignment}&#8221; SnapsToDevicePixels=&#8221;{TemplateBinding SnapsToDevicePixels}&#8221; RecognizesAccessKey=&#8221;True&#8221;/&gt;<br />
                        &lt;/StackPanel&gt;<br />
                    &lt;ControlTemplate.Triggers&gt;<br />
                        &lt;Trigger Property=&#8221;IsEnabled&#8221; Value=&#8221;false&#8221;&gt;<br />
                            &lt;Setter Property=&#8221;Foreground&#8221; Value=&#8221;{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}&#8221;/&gt;<br />
                        &lt;/Trigger&gt;<br />
                    &lt;/ControlTemplate.Triggers&gt;<br />
                &lt;/ControlTemplate&gt;<br />
            &lt;/Setter.Value&gt;<br />
        &lt;/Setter&gt;<br />
    &lt;/Style&gt;</span></p>
<p>This style can then be applied to a button as shown here:</p>
<p><span style="color:#0000ff;">&lt;Button Style=&#8221;{StaticResource ImageButtonStyle}&#8221;     DataContext=&#8221;/WpfApplication1;component/Close.png&#8221; Name=&#8221;CloseButton&#8221;&gt;Close&lt;/Button&gt; </span></p>
<p>The other advantage to using styles is the ability to change all object types to a particular style.  For example if you have a common library that is used in multiple applications, you can define the controls to be generic (no specific colors, size, etc.) and allow each of the applications to change the color and size to it’s own specifications.  To tell WPF to make the style apply to all controls, simply change the style declaration to use the type as the key as shown here:</p>
<p><span style="color:#0000ff;">&lt;Style x:Key=&#8221;{x:Type Button}&#8221; TargetType=&#8221;Button&#8221;&gt; </span></p>
<p>For the control, you do not need to specify any style, it will use the one defined in you dictionary as the default.</p>
<h2>Binding</h2>
<p>Binding can be one of the more difficult concepts to grasp because of its flexibility.  There are several good posts on binding including <a href="http://msdn.microsoft.com/en-us/magazine/cc163299.aspx" target="_blank"><span style="color:#006ff7;">http://msdn.microsoft.com/en-us/magazine/cc163299.aspx</span></a>  Here are a couple of the mistakes that I have seen:</p>
<p>In the first example, the idea is to load an xml file with state codes and descriptions for a combo box.  The user creates a dataset, reads all of the codes and then assigns the result to the combo box.  </p>
<p><span style="color:#0000ff;">DataSet ds = new DataSet();<br />
XElement statesElement = XElement.Load(“/Data/StateCodes.xml”);<br />
ds.ReadXml(statesElement.CreateReader());<br />
cboState.DataContext = ds.Tables[0];<br />
cboState.DisplayMemberPath = Settings.Default.StateMemberPath;</span></p>
<p>If you use the XmlDataProvider, you can bind the source to the provider as shown here:</p>
<p><span style="color:#0000ff;">&lt;XmlDataProvider x:Key=&#8221;StateData&#8221; Source=&#8221;/Data/StateCodes.xml&#8221; XPath=&#8221;//State&#8221; /&gt; </span></p>
<p><span style="color:#0000ff;">&lt;ComboBox ItemsSource=&#8221;{Binding Source={StaticResource StateData}}&#8221;<br />
          DisplayMemberPath=&#8221;@id&#8221; Name=&#8221;cboState&#8221; /&gt; </span></p>
<p>In the second example, there are two controls that work together.  Some examples would be using a label to display the value of a scrollbar or making two controls have the same width.  Here is an example of how you bind two controls together:</p>
<p><span style="color:#0000ff;">&lt;Slider Name=&#8221;sliderScale&#8221; Orientation=&#8221;Horizontal&#8221; Value=&#8221;1.0&#8243; /&gt; </span></p>
<p><span style="color:#0000ff;">&lt;Label Content=&#8221;{Binding ElementName=sliderScale, Path=Value, Mode=Default}&#8221;/&gt;</span></p>
<p>If you have types that are not compatible (e.g. a string to update a double) you will need to use a Converter.  This goes beyond the scope of this posting.</p>
<h2>Resources</h2>
<p>Resources can be stored internally or externally to the application.  If have a resource such as an image which will remain static, the resource can be compiled into the application and referenced in that manner.  Here is example of improperly referencing a static image:</p>
<p><span style="color:#0000ff;">imageBackground.Source = LoadBitmap(&#8220;/Images/GpsConnected.png&#8221;); </span></p>
<p><span style="color:#0000ff;">BitmapImage LoadBitmap(string path)<br />
{<br />
    byte[] bytes = File.ReadAllBytes(path);<br />
    MemoryStream memoryStream = new MemoryStream(bytes);<br />
    BitmapImage image = new BitmapImage();<br />
    image.CacheOption = BitmapCacheOption.OnLoad;<br />
    image.BeginInit();<br />
    image.StreamSource = memoryStream;<br />
    image.EndInit();<br />
    bytes = null; </span></p>
<p><span style="color:#0000ff;">    return image;<br />
}</span></p>
<p>The following code does the same thing:</p>
<p><span style="color:#0000ff;">imageBackground.Source = new BitmapImage(new Uri(GetBitmapFileName(&#8220;/eSketch;component/Images/GpsConnected.png&#8221;)));</span></p>
<h2>Callbacks</h2>
<p>The final piece that I will touch on is callbacks.  Though I have not tracked down the exact instances or cause, I have found that using in the following manner results in unpredictable exceptions.  It will sometimes cause the application to hang for no apparent reason.  The worst part about it is that it is not consistent.</p>
<p><span style="color:#0000ff;">delegate void SetTextCallback(string Text);<br />
private void WriteLongitude(string Text)<br />
{<br />
    if (txtGpsLongitude.Dispatcher.Thread != Thread.CurrentThread)<br />
    {<br />
        SetTextCallback callBack = new SetTextCallback(WriteLongitude);<br />
        Dispatcher.Invoke(DispatcherPriority.Send, callBack, Text);<br />
    }<br />
    else<br />
    {<br />
        txtGpsLongitude.Text = Text;<br />
    }<br />
} </span></p>
<p>As a result, I recommend using this method:</p>
<p><span style="color:#0000ff;">private void WriteLongitude(string text)<br />
{<br />
    Dispatcher.Invoke(DispatcherPriority.Send,<br />
                        new Action(() =&gt;<br />
                        {<br />
                            txtGpsLongitude.Text = text;<br />
                        }));<br />
} </span></p>
<h2>Summary</h2>
<p>With the flexibility that WPF provides, it can be difficult to get started and you can make more work for yourself.  My intent was to provide some pointers to help you from making more work for yourself. </p>
<p>In the future I will provide some more guidance including how to extent functionality such as comboboxes.  Feedback is always appreciated.</p>
<br />Posted in C#, WPF  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwetzel.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwetzel.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwetzel.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwetzel.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/davidwetzel.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/davidwetzel.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/davidwetzel.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/davidwetzel.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwetzel.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwetzel.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwetzel.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwetzel.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwetzel.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwetzel.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davidwetzel.wordpress.com&amp;blog=6706790&amp;post=10&amp;subd=davidwetzel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davidwetzel.wordpress.com/2009/03/01/wpf-using-winforms-%e2%80%93-wrong-approach/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f69c61cdaaf9953fab3c41fae59ddfec?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">David Wetzel</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF in South Florida</title>
		<link>http://davidwetzel.wordpress.com/2009/02/23/wpf-in-south-florida/</link>
		<comments>http://davidwetzel.wordpress.com/2009/02/23/wpf-in-south-florida/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 01:44:37 +0000</pubDate>
		<dc:creator>David Wetzel</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[.Net 3.5]]></category>

		<guid isPermaLink="false">http://davidwetzel.wordpress.com/?p=3</guid>
		<description><![CDATA[I have been working with WPF for about a year and a half now.  I really enjoy the flexibility that it provides but it does have quite a learning curve when you have been working with WinForms for most of your programming career. In the past 7 months, I have been given two different WPF [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davidwetzel.wordpress.com&amp;blog=6706790&amp;post=3&amp;subd=davidwetzel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="line-height:14.25pt;"><span style="font-size:10pt;font-family:&quot;">I have been working with WPF for about a year and a half now.  I really enjoy the flexibility that it provides but it does have quite a learning curve when you have been working with WinForms for most of your programming career. </span></p>
<p style="line-height:14.25pt;"><span style="font-size:10pt;font-family:&quot;">In the past 7 months, I have been given two different WPF applications which were started by other developers but could not get the application to QA or get it out of QA.<span>  </span>Digging into the code, it was pretty easy to see why they were having issues.<span>  </span>They were writing WinForms code with a Xaml front end.<span>  </span>This can have some rather strange and unpredictable behavior.<span>  </span>I decided that I would take some of these issues and create a blog to help out others who are attempting to make the transition to WPF.</span></p>
<p style="line-height:14.25pt;"><span style="font-size:10pt;font-family:&quot;">This is my first attempt at a blog and comments and advice are always appreciated.<span>  </span>If you have specific questions or topics that you would like to see covered, feel free to contact me.<span>  </span></span></p>
<br />Posted in C#, Silverlight, WPF Tagged: .Net 3.5, C#, Silverlight, WPF <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwetzel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwetzel.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwetzel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwetzel.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/davidwetzel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/davidwetzel.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/davidwetzel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/davidwetzel.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwetzel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwetzel.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwetzel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwetzel.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwetzel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwetzel.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davidwetzel.wordpress.com&amp;blog=6706790&amp;post=3&amp;subd=davidwetzel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davidwetzel.wordpress.com/2009/02/23/wpf-in-south-florida/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f69c61cdaaf9953fab3c41fae59ddfec?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">David Wetzel</media:title>
		</media:content>
	</item>
	</channel>
</rss>
