<?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"
	>

<channel>
	<title>GeekTieGuy &#187; WPF</title>
	<atom:link href="http://www.geektieguy.com/category/wpf/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geektieguy.com</link>
	<description>News and views from the geek tie guy.</description>
	<pubDate>Sat, 03 May 2008 23:07:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Inside the HP TouchSmart PC software: HP SmartCenter - Part 4</title>
		<link>http://www.geektieguy.com/2008/04/24/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-4/</link>
		<comments>http://www.geektieguy.com/2008/04/24/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-4/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 02:33:00 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Vista]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/?p=215</guid>
		<description><![CDATA[This is part 4 of the mini-series on the HP SmartCenter software. Hear about the team&#8217;s reaction to the Engadget leak and the launch plans at CES 2007. If you missed the first three parts, they are here, here and here.
&#8212;
One of the really unsettling events before the launch of the TouchSmart PC was that [...]]]></description>
			<content:encoded><![CDATA[<p>This is part 4 of the mini-series on the HP SmartCenter software. Hear about the team&#8217;s reaction to the Engadget leak and the launch plans at CES 2007. If you missed the first three parts, they are <a href="http://www.geektieguy.com/2008/04/04/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-1/" target="_blank">here</a>, <a href="http://www.geektieguy.com/2008/04/10/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-2/" target="_blank">here</a> and <a href="http://www.geektieguy.com/2008/04/17/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-3/" target="_blank">here</a>.</p>
<p>&#8212;</p>
<p>One of the really unsettling events before the launch of the TouchSmart PC was that Engadget somehow got a hold of some pictures that had been prepared for the launch in early 2007 at the Consumer Electronics Show. It was billed in the first sentence as &#8220;AMD&#8217;s sweet new rig&#8221;, which was a little bit of a slap in the face, since most of the real work fell outside of AMDs realm. I remember the team meeting when our program manager came in and told us about the &#8220;leak&#8221;. He had heard it from Microsoft just a few moments before joining the meeting. The mood in the room instantly turned. People started feeling both mad at the leaked information (and the leaker) and depressed about the potential impact this would have on our launch at CES. Microsoft especially was disappointed, since the TouchSmart PC represented a big investment on their part, carrying some of the Vista messaging. The TouchSmart PC was to be billed as one of a few &#8220;dream&#8221; PCs at CES. Having gone through an experience like that, I now always think about how the people involved must feel when I see &#8220;leaked&#8221; information about upcoming products. It&#8217;s not fun to have it happen to you.</p>
<p>On a happier note, the TouchSmart PC seemed to make quite a splash at CES. At the last minute I was asked to attend the show to help with technical support on the show floor. This was my first time attending CES and going to Las Vegas, and I quite enjoyed the experience. I ran into quite a few of the people that had worked with us on the project, and it was fun to see the crowds milling about the TouchSmart PCs at the HP and Microsoft booths. Having backstage access was a unique thing, but it involved a lot of walking around, helping the people doing demos by making sure the software was installed properly.</p>
<p>Since then, the HP TouchSmart PC has received numerous awards (including spot number seven on PC World&#8217;s list of most innovative products of 2007) and for a short while even had a fan website, the HP TouchSmart Owner&#8217;s Club.</p>
<p>&#8212;</p>
<p>This is the tentative end of the series. If you&#8217;re curious about other aspects, let me know, and if I can talk about it, I&#8217;ll see if I can accommodate your curiosity.</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=215&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_215" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2008/04/24/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-4/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Inside the HP TouchSmart PC software: HP SmartCenter - Part 3</title>
		<link>http://www.geektieguy.com/2008/04/17/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-3/</link>
		<comments>http://www.geektieguy.com/2008/04/17/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-3/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 02:30:48 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Vista]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/?p=214</guid>
		<description><![CDATA[Welcome to part 3 of this mini-series. Last time around you heard a little bit about the early prototypes and how things progressed from there. This time I&#8217;ll talk a bit more about some of the functionality in HP SmartCenter and some of the things we were not able to address before having to ship.
&#8212;
The guiding [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to part 3 of this mini-series. <a href="http://www.geektieguy.com/2008/04/10/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-2/" target="_blank">Last time</a> around you heard a little bit about the early prototypes and how things progressed from there. This time I&#8217;ll talk a bit more about some of the functionality in HP SmartCenter and some of the things we were not able to address before having to ship.</p>
<p>&#8212;</p>
<p>The guiding principles for HP SmartCenter and the other touch-optimized applications were to provide quick, &#8220;transactional&#8221; experiences, to have the applications be as intuitive as possible to use, and have them look polished and clean. HP SmartCenter was to be the &#8220;home page&#8221; for touch-based interactions with the PC. It had to easily give the user access to key Media Center experiences (TV, music, games) as well as two other touch-optimized programs HP was developing (HP SmartCalendar and HP Photosmart Touch). Finally the user had to have the ability to add access to a certain number of programs of their choice.</p>
<p>To enable some of the quick, &#8220;transactional&#8221; experiences using a touch screen, HP SmartCenter had to have large &#8220;target&#8221; areas that are easy to hit using a finger. This requirement helped making decisions about the layout of the &#8220;tiles&#8221; that the user touches to &#8220;launch&#8221; something.</p>
<p>We wanted to highlight a few of the key features of the TouchSmart suite of software. We decided that three tiles would be larger than the remaining ones, and that those three would be able to show more details from the underlying program than the smaller tiles. The calendar tile, for example, will pull three upcoming events out of the calendar program and display key information about those events right within the calendar tile. The Photosmart Touch tile will look for pictures in the My Pictures folder and display five of those in a rotation. The weather tile will display high and low temperatures expected for the day as well as the current temperature as reported by the weather service. The analog and digital clock tiles will display two additional clocks (probably configured for different time zones) in text form, in addition to the main clock, which is shown in a larger, graphical look.</p>
<p>The three user configurable tiles would be able to either start a program on the system or a web page, using Internet Explorer. We settled on only having three configurable items, since there was an overall limit in the graphical design at nine small tiles plus three large tiles, and we wanted to encourage people to stick with tiles that didn&#8217;t take you out of a touch-optimized / touch oriented environment.</p>
<p>Beyond picking a software development technology (WPF), our other challenges were the many changes in both Windows Vista and WPF as both matured. WPF introduced &#8220;breaking changes&#8221; several times in our short cycle, and we discovered numerous problems with the integration of WPF and Windows Media Center. We worked closely with Microsoft to get these addressed. But a few problems remained, one of which is that every time you start one of the programs we developed, the computer screen will go black for a few seconds. It gives you the unsettling feeling that something went wrong, but it&#8217;s actually a consequence of the interactions between certain software components that are controlling the graphics card (DirectX, WPF and Media Center). As much as we didn&#8217;t like it, we were out of time to address these problems by the time our shipping date came.</p>
<p>&#8212;</p>
<p>That&#8217;s a wrap for part 3. Next time you&#8217;ll hear about the reactions from the team when information about the TouchSmart PC was leaked to Engadget way before the actual launch event, and I&#8217;ll also talk a little about the launch at CES 2007.</p>
<p>Update (2008-04-30): Part <a href="http://www.geektieguy.com/2008/04/24/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-4/" target="_blank">four</a> is now posted.</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=214&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_214" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2008/04/17/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Inside the HP TouchSmart PC software: HP SmartCenter - Part 2</title>
		<link>http://www.geektieguy.com/2008/04/10/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-2/</link>
		<comments>http://www.geektieguy.com/2008/04/10/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-2/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 02:12:10 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Vista]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2008/04/04/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-2/</guid>
		<description><![CDATA[In the first part of this mini-series, I introduced you to the early planning stages of HP SmartCenter. This time you&#8217;ll get a little more information on the early development, including a few screenshots of prototpyes.
&#8212;
I hacked together a very simple first version of HP SmartCenter (then codenamed LaunchPad, which still is the name of [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.geektieguy.com/2008/04/04/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-1/" target="_blank">first part</a> of this mini-series, I introduced you to the early planning stages of HP SmartCenter. This time you&#8217;ll get a little more information on the early development, including a few screenshots of prototpyes.</p>
<p>&#8212;</p>
<p>I hacked together a very simple first version of HP SmartCenter (then codenamed LaunchPad, which still is the name of the executable, incidentally) in HTML and my colleague Maguy added some rough graphical elements to give our design firm an idea of what we were looking for.</p>
<p><a title="launchpad1.png" href="http://www.geektieguy.com/wp-content/uploads/2007/04/launchpad1.png"></a><a title="launchpad1.png" href="http://www.geektieguy.com/wp-content/uploads/2007/04/launchpad1.png"></a></p>
<p style="text-align: center"><img src="http://www.geektieguy.com/wp-content/uploads/2007/04/launchpad1.thumbnail.png" alt="launchpad1.png" /><br />
My quick HTML mockup</p>
<p><a title="launchpad2.png" href="http://www.geektieguy.com/wp-content/uploads/2007/04/launchpad2.png"></a><a title="launchpad2.png" href="http://www.geektieguy.com/wp-content/uploads/2007/04/launchpad2.png"></a></p>
<p style="text-align: center"><img src="http://www.geektieguy.com/wp-content/uploads/2007/04/launchpad2.thumbnail.png" alt="launchpad2.png" /><br />
Improved graphics</p>
<p>From about February 2006 until April 2006 we then iterated with our design firm on the GUI and user experience design. Towards the end of May 2006 we took final delivery of the work from them. I was to turn their beautiful work into a living application with page navigation, drag-and-drop functionality, configuration options, and settings persistence. They had provided a solid foundation to build on, including well thought out namespaces, classes, animations and navigation design.</p>
<p>But there was still a lot of work to be done during the next three to four months. In addition to the application itself I was also responsible for delivering an installer, a supporting &#8220;touch optimization&#8221; program, and integration with our factory PC build process, including dealing with the &#8220;sealing&#8221; process that prepares the master hard drive for replication.</p>
<p>We participated in Microsoft&#8217;s early adopter program for Windows Presentation Foundation and Windows Vista, which gave us access to builds of the WPF bits, with a seemingly never-ending stream of Community Technology Preview versions. Windows Vista was in a similar state of flux, and I had my hands full, wiping out and reinstalling test machines and updating my developer machine to keep up with the changes.</p>
<p>At the same time I climbed the learning curve for WPF (which <a href="http://psiman.spaces.live.com/blog/cns!5BCA275B0A537D6B!639.entry">Simon Middlemiss</a> once described as more of a cliff), trying to figure out how to get the mostly fixed-content XAML pages that the design company had delivered turned into malleable components and re-configurable layouts.</p>
<p>The initial design from the outside company included two components that pull information from the web: weather and stocks. We had to drop the stocks piece for business reasons early on, and had big challenges working out the business issues for the weather feed integration. We wanted our own high-quality images to illustrate the weather conditions and had to get approval from the owner of the feed data. I thought several times that the weather feature was dead, but stubbornness overcame pessimism, and we pulled all the right people from several companies together to get our images approved within 24 hours before the final code submittal deadline. I remember pulling a work-at-home weekend to fine-tune the weather feature where I had to stop working because I was hit with the flu. I was out for three days. After something like that happens you don&#8217;t give up a feature without a fight.</p>
<p>One benefit of being part of the early adopter program for WPF and Vista was that Microsoft arranged for training and troubleshooting sessions. I made two trips to Redmond under this program, once to get more in-depth training on WPF and Vista, and once to get help with troubleshooting <a href="http://www.geektieguy.com/2006/08/23/compositiontargetrendering-can-be-a-cpu-hog/" target="_blank">performance issues</a> we had run into. That&#8217;s when I learned that there is such a thing as a &#8220;<a href="http://www.geektieguy.com/2006/08/07/remember-to-unhook-those-event-handlers/" target="_blank">managed memory leak</a>&#8220;, which can be introduced in WPF without the programmer necessarily realizing it. Towards the end of the program three of my colleagues and I got to spend a couple of days with Microsoft again, this time at their Platform Adoption lab (Building 20), going over some last minute design and performance questions with their WPF developers one-on-one. This especially helped with getting HP Photosmart Touch into better shape for final release. We got a lot of tips and strategies for dealing with images, collections and containers in these sessions.</p>
<p>&#8212;</p>
<p>That&#8217;s it for part 2. Next time I&#8217;ll dig a little more into the guiding principles that were used for the implementation of HP SmartCenter, as well as some of the challenges and problems I encountered on the way.</p>
<p>Update (2008-04-30): Parts <a href="http://www.geektieguy.com/2008/04/17/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-3/" target="_blank">three</a> and <a href="http://www.geektieguy.com/2008/04/24/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-4/" target="_blank">four</a> are now posted.</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=213&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_213" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2008/04/10/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Inside the HP TouchSmart PC software: HP SmartCenter - Part 1</title>
		<link>http://www.geektieguy.com/2008/04/04/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-1/</link>
		<comments>http://www.geektieguy.com/2008/04/04/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-1/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 05:23:59 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Vista]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2008/04/04/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-1/</guid>
		<description><![CDATA[I thought some people might enjoy reading a little &#8220;behind the scenes&#8221; story about the most high-profile piece of software I&#8217;ve been involved with so far. I feel pretty lucky to have had the chance to work on a unique product and to have what I helped work on be so central to the user [...]]]></description>
			<content:encoded><![CDATA[<p>I thought some people might enjoy reading a little &#8220;behind the scenes&#8221; story about the most high-profile piece of software I&#8217;ve been involved with so far. I feel pretty lucky to have had the chance to work on a unique product and to have what I helped work on be so central to the user experience as it is on the HP TouchSmart PC. You may interpret this post as highly egotistical and self-centered, and I suppose it is. But I feel like telling a story. My story. I will go over most of the non-confidential details of the events as I remember them. Since there&#8217;s a lot to talk about, I&#8217;ve decided to split the story into a mini-series. This is part one. Here we go.</p>
<p>My involvement with the HP TouchSmart PC began in about December of 2005. The decision was made to invest in software that would be best suited for the touchscreen that the unit would have. One of the results is HP SmartCenter as seen here (screenshot from my developer machine, not necessarily representative of the final product):</p>
<p style="text-align: center"><a href="http://www.geektieguy.com/wp-content/uploads/2007/01/WindowsLiveWriter/TheHPTouchSmartPC_757A/SmartCenter013.png"><br />
<img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://www.geektieguy.com/wp-content/uploads/2007/01/WindowsLiveWriter/TheHPTouchSmartPC_757A/SmartCenter01_thumb1.png" border="0" alt="" width="444" height="249" /></a></p>
<p>We had tight deadlines. Our final bits would be due in about six months, around June / July 2006. Our product marketing folks decided they wanted the touch application to provide quick access to TV and music as primary features. Windows Media Center was our software of choice for delivering TV and music experiences, and so we made HP SmartCenter run within Windows Media Center. This helped to avoid waiting for Media Center to start up when the user wants to watch TV or listen to music. In other areas the choice created lots of challenges. The initial one was picking a software development technology.</p>
<p>I had just attended PDC05 and was pretty excited about <a href="http://wpf.netfx3.com/">Windows Presentation Foundation</a> (WPF) and the speed I could sense it would give developers and designers for rapidly creating exciting software. I had learned that Media Center in Windows Vista would support WPF, and my recommendation to use it for our apps to make the deadlines while delivering a polished user interface was accepted.</p>
<p>An interface developed in HTML would not have had the same quality (read: look-and-feel). Using the Media Center Markup Language (MCML / SplashFX) was not an option, since that was not going to be revealed in any useful detail until about March 2006, way too late for us to learn how to use it and produce a product.</p>
<p>At PDC05, it had been mentioned that a well-know design company had worked on some XAML styles for the show. We approached them to help out with the application design and asked them to deliver their stuff as working XAML / WPF code. They were pretty excited about the idea and signed on.</p>
<p>&#8212;</p>
<p>That&#8217;s it for now. Check back soon for the next installment of this mini-series, where I&#8217;ll show you a few screenshots of very early prototypes.</p>
<p>Update (2008-04-30): Parts <a href="http://www.geektieguy.com/2008/04/10/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-2/" target="_blank">two</a>, <a href="http://www.geektieguy.com/2008/04/17/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-3/" target="_blank">three</a> and <a href="http://www.geektieguy.com/2008/04/24/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-4/" target="_blank">four</a> are now posted.</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=212&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_212" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2008/04/04/inside-the-hp-touchsmart-pc-software-hp-smartcenter-part-1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Can&#8217;t install .NET 3.5 on Vista x64? Try uninstalling KB110806.</title>
		<link>http://www.geektieguy.com/2008/02/01/cant-install-net-35-on-vista-x64-try-uninstalling-kb110806/</link>
		<comments>http://www.geektieguy.com/2008/02/01/cant-install-net-35-on-vista-x64-try-uninstalling-kb110806/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 17:22:04 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[Software]]></category>

		<category><![CDATA[Vista]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2008/02/01/cant-install-net-35-on-vista-x64-try-uninstalling-kb110806/</guid>
		<description><![CDATA[The title says it all. Several attempts I&#8217;ve made at installing the .NET Framework 3.5 on x64 Vista boxes failed with Error 1603. After a prolonged Google search, I found a forum with someone mentioning to uninstall KB110806, which seems to be related to .NET 2.0 SP1. I forget the forum and the details.
Anyway, if you&#8217;re having trouble [...]]]></description>
			<content:encoded><![CDATA[<p>The title says it all. Several attempts I&#8217;ve made at installing the .NET Framework 3.5 on x64 Vista boxes failed with Error 1603. After a prolonged Google search, I found a forum with someone mentioning to uninstall KB110806, which seems to be related to .NET 2.0 SP1. I forget the forum and the details.</p>
<p>Anyway, if you&#8217;re having trouble with .NET 3.5 on Vista x64, try uninstalling the KB110806 update. I&#8217;m going to assume you know where to do that if you&#8217;re reading this.</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=166&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_166" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2008/02/01/cant-install-net-35-on-vista-x64-try-uninstalling-kb110806/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WPF ControlTemplate Trigger tip</title>
		<link>http://www.geektieguy.com/2008/01/05/wpf-controltemplate-trigger-tip/</link>
		<comments>http://www.geektieguy.com/2008/01/05/wpf-controltemplate-trigger-tip/#comments</comments>
		<pubDate>Sat, 05 Jan 2008 09:11:10 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[Software development]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2008/01/05/wpf-controltemplate-trigger-tip/</guid>
		<description><![CDATA[I didn&#8217;t fully realize how ControlTemplate Triggers work (or don&#8217;t) until I solved a problem with a UserControl today, with the help of this post on the MSDN forums.
A Triggers&#8217; EnterActions or ExitActions don&#8217;t seem to get fired when a UserControl is constructed. If you want, say, an animation in your control to start on [...]]]></description>
			<content:encoded><![CDATA[<p>I didn&#8217;t fully realize how ControlTemplate Triggers work (or don&#8217;t) until I solved a problem with a UserControl today, with the help of <a href="http://207.46.236.188/MSDN/ShowPost.aspx?PostID=2115735&amp;SiteID=1">this post on the MSDN forums</a>.</p>
<p>A Triggers&#8217; EnterActions or ExitActions don&#8217;t seem to get fired when a UserControl is constructed. If you want, say, an animation in your control to start on a property change, you can put a BeginStoryboard element into a Trigger&#8217;s EnterActions and a reverse BeginStoryboard into the ExitActions.</p>
<p>But for the control to start out right at initialization you also need to have the right Setter element on the Trigger to set initial states (in addition to setting the opposite initial states on the elements to be animated/initialized.)</p>
<p>Here&#8217;s a tiny example:</p>
<p style="display: inline; float: none; margin: 0px; padding: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:58d52c37-3145-4c1b-863f-0f57715a3603" class="wlWriterSmartContent">
<pre style="overflow: auto; background-color: white; word-wrap: break-word"><!-- 

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/ 

--><span style="color: #008080"> 1</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"> </span><span style="color: #008000">&lt;!&#8211;</span><span style="color: #008000"> Namespaces omitted for brevity </span><span style="color: #008000">&#8211;&gt;</span><span style="color: #000000">
</span><span style="color: #008080"> 2</span> <span style="color: #000000">  </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080"> 3</span> <span style="color: #000000">    </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">ToggleButton </span><span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&#8221;Toggle&#8221;</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080"> 4</span> <span style="color: #000000">      </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">ToggleButton.Template</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080"> 5</span> <span style="color: #000000">        </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">ControlTemplate </span><span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&#8221;</span><span style="color: #808000">{x:Type ToggleButton}</span><span style="color: #0000ff">&#8220;</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080"> 6</span> <span style="color: #000000">          </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080"> 7</span> <span style="color: #000000">            </span><span style="color: #008000">&lt;!&#8211;</span><span style="color: #008000"> Initial opacity is 1 for the initially unchecked ToggleButton state. A trigger changes it to 0 for an initial checked state. </span><span style="color: #008000">&#8211;&gt;</span><span style="color: #000000">
</span><span style="color: #008080"> 8</span> <span style="color: #000000">            </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid </span><span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&#8221;HideMe&#8221;</span><span style="color: #ff0000"> Opacity</span><span style="color: #0000ff">=&#8221;1&#8243;</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080"> 9</span> <span style="color: #000000">              </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">TextBlock </span><span style="color: #ff0000">Text</span><span style="color: #0000ff">=&#8221;Hidden&#8221;</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000">
</span><span style="color: #008080">10</span> <span style="color: #000000">            </span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">11</span> <span style="color: #000000">            </span><span style="color: #008000">&lt;!&#8211;</span><span style="color: #008000"> Other parts of the control go here </span><span style="color: #008000">&#8211;&gt;</span><span style="color: #000000">
</span><span style="color: #008080">12</span> <span style="color: #000000">          </span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">13</span> <span style="color: #000000">          </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">ControlTemplate.Triggers</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">14</span> <span style="color: #000000">            </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">Trigger </span><span style="color: #ff0000">Property</span><span style="color: #0000ff">=&#8221;ToggleButton.IsChecked&#8221;</span><span style="color: #ff0000"> Value</span><span style="color: #0000ff">=&#8221;True&#8221;</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">15</span> <span style="color: #000000">              </span><span style="color: #008000">&lt;!&#8211;</span><span style="color: #008000"> This setter hides the desired element when the ToggleButton&#8217;s initial state is checked </span><span style="color: #008000">&#8211;&gt;</span><span style="color: #000000">
</span><span style="color: #008080">16</span> <span style="color: #000000">              </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter </span><span style="color: #ff0000">TargetName</span><span style="color: #0000ff">=&#8221;HideMe&#8221;</span><span style="color: #ff0000"> Property</span><span style="color: #0000ff">=&#8221;Opacity&#8221;</span><span style="color: #ff0000"> Value</span><span style="color: #0000ff">=&#8221;0&#8243;</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000">
</span><span style="color: #008080">17</span> <span style="color: #000000">              </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">Trigger.EnterActions</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">18</span> <span style="color: #000000">                </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">BeginStoryboard</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">19</span> <span style="color: #000000">                  </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">Storyboard</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">20</span> <span style="color: #000000">                    </span><span style="color: #0000ff">&lt;</span><span style="color: #800000">DoubleAnimation </span><span style="color: #ff0000">BeginTime</span><span style="color: #0000ff">=&#8221;00:00:00&#8243;</span><span style="color: #ff0000"> Duration</span><span style="color: #0000ff">=&#8221;00:00:00.05&#8243;</span><span style="color: #ff0000"> Storyboard.TargetName</span><span style="color: #0000ff">=&#8221;HideMe&#8221;</span><span style="color: #ff0000"> Storyboard.TargetProperty</span><span style="color: #0000ff">=&#8221;(UIElement.Opacity)&#8221;</span><span style="color: #ff0000"> To</span><span style="color: #0000ff">=&#8221;0&#8243;</span><span style="color: #ff0000"> </span><span style="color: #0000ff">/&gt;</span><span style="color: #000000">
</span><span style="color: #008080">21</span> <span style="color: #000000">                  </span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Storyboard</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">22</span> <span style="color: #000000">                </span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">BeginStoryboard</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">23</span> <span style="color: #000000">              </span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Trigger.EnterActions</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">24</span> <span style="color: #000000">              </span><span style="color: #008000">&lt;!&#8211;</span><span style="color: #008000"> ExitActions go here to make the Grid with the TextBlock visible again </span><span style="color: #008000">&#8211;&gt;</span><span style="color: #000000">
</span><span style="color: #008080">25</span> <span style="color: #000000">            </span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Trigger</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">26</span> <span style="color: #000000">          </span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">ControlTemplate.Triggers</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">27</span> <span style="color: #000000">        </span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">ControlTemplate</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">28</span> <span style="color: #000000">      </span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">ToggleButton.Template</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">29</span> <span style="color: #000000">    </span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">ToggleButton</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">30</span> <span style="color: #000000">  </span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">
</span><span style="color: #008080">31</span> <span style="color: #000000"></span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>The ToggleButton contains a TextBlock in line 9 that I want hidden when the ToggleButton&#8217;s IsChecked state is True. The animation in line 18 takes care of doing that when the user interacts with the control, but when the control is initialized, I need the Setter in line 16 to hide the TextBlock initially if the ToggleButton is checked by default (through data binding, for example.)</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=165&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_165" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2008/01/05/wpf-controltemplate-trigger-tip/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Introducing CardSharkV</title>
		<link>http://www.geektieguy.com/2007/11/25/introducing-cardsharkv/</link>
		<comments>http://www.geektieguy.com/2007/11/25/introducing-cardsharkv/#comments</comments>
		<pubDate>Sun, 25 Nov 2007 08:06:56 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[Software]]></category>

		<category><![CDATA[Software development]]></category>

		<category><![CDATA[Vista]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2007/11/25/introducing-cardsharkv/</guid>
		<description><![CDATA[Check out this program I&#8217;ve developed, called CardSharkV. It&#8217;s a digital picture storage card/camera &#8220;downloader&#8221; with a twist.
It&#8217;s a bit of an experiment, and I&#8217;m looking for some real-world &#8220;beta&#8221; testers. My plan is to try my hand at charging for the program. But to see if word will spread, I&#8217;m planning to give out [...]]]></description>
			<content:encoded><![CDATA[<p>Check out this program I&#8217;ve developed, called CardSharkV. It&#8217;s a digital picture storage card/camera &#8220;downloader&#8221; with a twist.</p>
<p>It&#8217;s a bit of an experiment, and I&#8217;m looking for some real-world &#8220;beta&#8221; testers. My plan is to try my hand at charging for the program. But to see if word will spread, I&#8217;m planning to give out 50 or so licenses without charge while I work out any kinks that might be in the program.</p>
<p>If you&#8217;re interested in trying it out, download the program, install and run it, and then click the &#8220;Request License&#8221; button.</p>
<p>Read more about it on the <a href="http://www.geektieguy.com/products/">CardSharkV page</a>.</p>
<p>Update (2007-11-25): CardSharkV depends on the .NET Framework 3.0. It&#8217;s thus meant to be installed on Vista systems only. If you have XP and the .NET Framework 3.0, it should still work. Also, since I posted the whole thing Saturday night after a whole day of re-shaping my first, never published version, I didn&#8217;t test the install too well. I&#8217;ve since had a little time to test and found some issues, especially with the license mechanism. I&#8217;ve posted version 1.0.2.0 to correct those issues and to improve the installer as well.</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=139&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_139" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2007/11/25/introducing-cardsharkv/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Microsoft deprecates support for XBAP WPF apps in version 5.3 of the Media Center SDK</title>
		<link>http://www.geektieguy.com/2007/11/19/microsoft-deprecates-support-for-xbap-wpf-apps-in-version-53-of-the-media-center-sdk/</link>
		<comments>http://www.geektieguy.com/2007/11/19/microsoft-deprecates-support-for-xbap-wpf-apps-in-version-53-of-the-media-center-sdk/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 05:02:28 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Opinion]]></category>

		<category><![CDATA[Software development]]></category>

		<category><![CDATA[Vista]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2007/11/19/microsoft-deprecates-support-for-xbap-wpf-apps-in-version-53-of-the-media-center-sdk/</guid>
		<description><![CDATA[I downloaded and installed the latest version of the Media Center SDK just now, and was a bit surprised to see that WPF apps are now officially deprecated as a supported way of extending Windows Media Center on Vista. There&#8217;s no big announcement around this so far, it&#8217;s almost just a footnote in the &#8220;What&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I downloaded and installed the latest version of the Media Center SDK just now, and was a bit surprised to see that WPF apps are now officially deprecated as a supported way of extending Windows Media Center on Vista. There&#8217;s no big announcement around this so far, it&#8217;s almost just a footnote in the &#8220;What&#8217;s New&#8221; section:</p>
<blockquote><p><b>Deprecated features</b> </p>
<p>The following features have been deprecated:
<ul>
<li>Hosting for Microsoft .NET Framework 3.0 Extensible Application Markup Language (XAML) browser applications (XBAPs).  </li>
<li>The Triple-tap/Soft-keyboard ActiveX control for hosted HTML applications.  </li>
<li>Support for using alternative shells to run and host HTML applications.</li>
</ul>
</blockquote>
<p>The reason I&#8217;m surprised is that Microsoft announced the support for WPF based extensibility apps at PDC05 with some fanfare.</p>
<p>I guess interest among developers just hasn&#8217;t been there for WPF-based Media Center apps, and Microsoft needs to make judgment calls on where to invest in their extensibility platform. The rest of the deprecated features seem to have been made for the same reason: limited interest among developers for these features. In addition I think there might be issues of an architectural nature that just make the three things that got dropped too expensive to maintain or improve.</p>
<p>I&#8217;m sad about this development, mostly because I still don&#8217;t see a great set of development and design tools around for MCML. WPF seems to me to have a whole lot more momentum than MCML (WPF has the Expression suite of tools and has been billed as the &#8220;GDI for the next 20 years&#8221;), but who knows what may be coming for Windows 7, or even an earlier interim update for Media Center?</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=137&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_137" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2007/11/19/microsoft-deprecates-support-for-xbap-wpf-apps-in-version-53-of-the-media-center-sdk/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Debugging XBAP applications on Vista using Visual Studio 2005</title>
		<link>http://www.geektieguy.com/2007/01/23/debugging-xbap-applications-on-vista-using-visual-studio-2005/</link>
		<comments>http://www.geektieguy.com/2007/01/23/debugging-xbap-applications-on-vista-using-visual-studio-2005/#comments</comments>
		<pubDate>Wed, 24 Jan 2007 00:35:27 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[Software development]]></category>

		<category><![CDATA[Vista]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2007/01/23/debugging-xbap-applications-on-vista-using-visual-studio-2005/</guid>
		<description><![CDATA[I ran into an interesting little quirk with Visual Studio 2005 on Vista yesterday. I was trying to start an XBAP debugging session from VS (using the F5 key), and none of my breakpoints got triggered. Upon exiting the IE instance that hosts PresentationHost.exe, VS considered the session as still &#8220;running&#8221;.
I had set my system [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into an interesting little quirk with Visual Studio 2005 on Vista yesterday. I was trying to start an XBAP debugging session from VS (using the F5 key), and none of my breakpoints got triggered. Upon exiting the IE instance that hosts PresentationHost.exe, VS considered the session as still &#8220;running&#8221;.</p>
<p>I had set my system up according to Tim Sneath&#8217;s post on <a href="http://blogs.msdn.com/tims/archive/2006/12/20/building-a-perfect-wpf-developer-workstation.aspx">the perfect WPF developer system,</a> including VS 2005 SP1 and the beta version of the Vista extensions for VS 2005. I was running VS &#8220;as administrator&#8221;.</p>
<p>As it turns out there are some technical details around starting XBAP debugging sessions from an elevated VS process that cause this behavior <strong>if you already have another instance of IE running when starting the debugging session</strong>.</p>
<p>Thanks to Tim Sneath and Chango Valtchev at Microsoft&nbsp;for helping in tracking this down!</p>
<p>Moral of the story: If you want to debug an XBAP from VS 2005 under Vista, run VS non-elevated, or make sure you have no other instances of IE running when you start the debugging session.</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=62&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_62" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2007/01/23/debugging-xbap-applications-on-vista-using-visual-studio-2005/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Localizing an XBAP application without using LocBaml</title>
		<link>http://www.geektieguy.com/2006/12/12/localizing-an-xbap-application-without-using-locbaml/</link>
		<comments>http://www.geektieguy.com/2006/12/12/localizing-an-xbap-application-without-using-locbaml/#comments</comments>
		<pubDate>Tue, 12 Dec 2006 23:23:50 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[Software development]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2006/12/12/localizing-an-xbap-application-without-using-locbaml/</guid>
		<description><![CDATA[Using the LocBaml sample application that Microsoft provides with the Windows SDK for Windows Presentation Foundation can be very frustrating. By default it seems to pick up a lot of things that clutter the resulting CSV file. If your application contains a lot of image resources, those will get duplicated in the localized resource dlls [...]]]></description>
			<content:encoded><![CDATA[<p>Using the LocBaml sample application that Microsoft provides with the Windows SDK for Windows Presentation Foundation can be very frustrating. By default it seems to pick up a lot of things that clutter the resulting CSV file. If your application contains a lot of image resources, those will get duplicated in the localized resource dlls as well, increasing the space that your application occupies on the hard drive. And finally, getting an XBAP application to be deployable after localization with LocBaml requires opening up the application manifest and adding all the localized resource files to it. Otherwise a deployment error will bite you.</p>
<p>So with all those problems, we decided to take a different approach for our WPF XBAP applications. We put all our strings into a standalone XAML file, producing a ResourceDictionary. This way our application can pick up strings using Text=&#8221;{StaticResource strXYZ}&#8221; for XAML markup and/or use Application.Current.FindResource(&#8221;strXYZ&#8221;) for codebehind. We name the file &#8220;Strings_en-US.xaml&#8221;. We can localize this file nicely, and name the resulting set appropriately: &#8220;Strings_de-DE.xaml&#8221;, &#8220;Strings_fr-FR.xaml&#8221; and so on. These files can then be included as resources in the application. They can also be added as &#8220;loose&#8221; XAML files, so we can add languages or make corrections after compilation.</p>
<p>The string resource file looks something like this:<br />
<font size="1"></p>
<pre>
<code>

&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"
&gt;
  &lt;sys:String x:Key="strButtonOK"&gt;OK&lt;/sys&gt;
  &lt;sys:String x:Key="strButtonCancel"&gt;Cancel&lt;/sys&gt;
&lt;/ResourceDictionary&gt;

</code>
</pre>
<p></font></p>
<p>At application load time, we look at the CurrentCulture and attempt to load the ResourceDictionary object like this:<br />
<font size="1"></p>
<pre>
<code>
ResourceDictionary rd = null;
System.Globalization.CultureInfo ci =
     System.Globalization.CultureInfo.CurrentCulture;
string langCountry = ci.Name;
string languageFile =
     string.Format("/Resources/Strings/Strings_{0}.xaml", langCountry);
try
{
  rd = (ResourceDictionary)Application.LoadComponent(
                              new Uri(languageFile, UriKind.RelativeOrAbsolute)
                                  );
}
</code>
</pre>
<p></font><br />
You can imagine this with some catch {} fallbacks for when a specific language-country combination doesn&#8217;t exist. We&#8217;ll fall back to a file that&#8217;s only language specific, and if that doesn&#8217;t work out, we&#8217;ll fall back to en-US. </p>
<p>We&#8217;re not using CurrentUICulture, since that seems to be tied to the UI language of Vista, and we want our apps to follow what the user sets in Control Panel. CurrentCulture seems to work for that.</p>
<p>To load the strings into the global resource dictionary, we just do</p>
<pre><code>
Application.Current.Resources.MergedDictionaries.Add(rd);
</code></pre>
<p>
To load loose XAML files that are not part of the application&#8217;s resources, we do something like this:<br />
<font size="1"></p>
<pre>
<code>
ResourceDictionary rd1 = null;
string languageFileLoose = string.Format(
         "pack://siteoforigin:,,,/Resources/Strings/Strings_{0}.xaml",
         langCountry
      );
Uri uri = new Uri(languageFileLoose, UriKind.Absolute);
System.Windows.Resources.StreamResourceInfo info;
System.Windows.Markup.XamlReader reader;
try {
  info = Application.GetRemoteStream(uri);
  reader = new System.Windows.Markup.XamlReader();
  rd1 = (ResourceDictionary)reader.LoadAsync(info.Stream);
}
</code>
</pre>
<p></font></p>
<p>Again, we extend this with catch {} blocks to fall back to a file that&#8217;s only language specific. We do the loose XAML loading after we&#8217;ve loaded embedded resources, so we can rely on a basic set of languages and strings, but can add languages, fix string translation errors or make improvements in the loose XAML after compiling things.</p>
<p>It may work for you as well, but ymmv.</p>
<p><strong>Update:</strong> Changed the first Uri to UriKind.RelativeOrAbsolute</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=49&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_49" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2006/12/12/localizing-an-xbap-application-without-using-locbaml/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Breaking all rules of software release management</title>
		<link>http://www.geektieguy.com/2006/11/13/breaking-all-rules-of-software-release-management/</link>
		<comments>http://www.geektieguy.com/2006/11/13/breaking-all-rules-of-software-release-management/#comments</comments>
		<pubDate>Tue, 14 Nov 2006 06:01:50 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2006/11/13/breaking-all-rules-of-software-release-management/</guid>
		<description><![CDATA[The project I&#8217;m currently working on is getting really close to being done, with Windows Vista having been &#8220;RTM&#8221;ed recently. We have a few more days to get last minute bugs ironed out and then it&#8217;s &#8220;off to the factories&#8221;&#8230; I can&#8217;t say much more about the project right now, but it&#8217;s a pretty significant and highly [...]]]></description>
			<content:encoded><![CDATA[<p>The project I&#8217;m currently working on is getting really close to being done, with Windows Vista having been &#8220;RTM&#8221;ed recently. We have a few more days to get last minute bugs ironed out and then it&#8217;s &#8220;off to the factories&#8221;&#8230; I can&#8217;t say much more about the project right now, but it&#8217;s a pretty significant and highly visible piece of software coming out somehwere around February 2007. I hope it does well. But I digress&#8230;</p>
<p>At this late a stage in a product&#8217;s delivery cycle it is common to make very few changes to the code in order not to create more bugs than one fixes. Ideally each change should be peer-reviewed and thouroughly tested before getting checked in (like with Windows Vista and the contortions people have to go through in the &#8220;shiproom&#8221; to get a bugfix approved). Too bad for me that I&#8217;m the only &#8220;peer&#8221; on the project (i.e. I&#8217;m the only developer). There&#8217;s nobody I can go to for a review.</p>
<p>And in the last few weeks I&#8217;ve broken the &#8220;as few changes as possible&#8221; rule a number of times. Why? Because I&#8217;m confident in the features that WPF provides. And because I do tend to run extensive tests before I check stuff in.</p>
<p>So what kinds of changes have I put in at the &#8220;last minute&#8221;? I&#8217;ve shuffled buttons around on the page, I&#8217;ve added code for drawing the user&#8217;s eyes to input fields containing invalid data, I&#8217;ve added data-bound and data-driven UI elements.</p>
<p>WPF has given me the confidence to be able to do this at the last minute. The fact that moving buttons around is a simple XAML markup change, for example, is just great for last minute UI adjustments.</p>
<p>But I&#8217;m not exactly proud of doing it. Oh well. So far everything seems to have worked out.</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=34&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_34" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2006/11/13/breaking-all-rules-of-software-release-management/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WPF XBAP apps and UAC</title>
		<link>http://www.geektieguy.com/2006/11/04/wpf-xbap-apps-and-uac/</link>
		<comments>http://www.geektieguy.com/2006/11/04/wpf-xbap-apps-and-uac/#comments</comments>
		<pubDate>Sat, 04 Nov 2006 19:40:44 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2006/11/04/wpf-xbap-apps-and-uac/</guid>
		<description><![CDATA[Here&#8217;s an interesting thing I learned the other day, which wasn&#8217;t obvious to me.
If you have an XBAP WPF application that tries to access files at the location identified by CSIDL_COMMON_APPDATA (Environment.SpecialFolders.CommonApplicationData in .Net 2.0/3.0) they need to be marked with Read/Write permissions for &#8221;Everyone&#8221;. Otherwise File Virtualization kicks in and Vista creates copies of the files [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an interesting thing I learned the other day, which wasn&#8217;t obvious to me.</p>
<p>If you have an XBAP WPF application that tries to access files at the location identified by CSIDL_COMMON_APPDATA (Environment.SpecialFolders.CommonApplicationData in .Net 2.0/3.0) they need to be marked with Read/Write permissions for &#8221;Everyone&#8221;. Otherwise File Virtualization kicks in and Vista creates copies of the files in the VirtualStore.</p>
<p>This shouldn&#8217;t be a problem per se, but if you have data integrity issues with your application reading/writing files it&#8217;s nice to eliminate the virtualization for troubleshooting.</p>
<p>Also, if your application needs to share the same data among users you don&#8217;t want virtualization, since that is a per-user thing, and you&#8217;d end up with one set of data files for each user.</p>
<p>If you&#8217;re installing some default data files for the application using Windows Installer (which will run elevated), you need to make sure you change the permissions on the data files so &#8220;Everyone&#8221; gets read/write permissions. This can be done using the LockPermissions table of Windows Installer.</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=31&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_31" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2006/11/04/wpf-xbap-apps-and-uac/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How did I end up working with Windows Presentation Foundation?</title>
		<link>http://www.geektieguy.com/2006/10/09/how-did-i-end-up-working-with-windows-presentation-foundation/</link>
		<comments>http://www.geektieguy.com/2006/10/09/how-did-i-end-up-working-with-windows-presentation-foundation/#comments</comments>
		<pubDate>Mon, 09 Oct 2006 14:20:32 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2006/10/09/how-did-i-end-up-working-with-windows-presentation-foundation/</guid>
		<description><![CDATA[In one of my past posts, I talked a little about my impressions of Vista as a platform for software developers. Here&#8217;s the story of how I got involved with WPF.
My last two projects before starting on WPF were built around hosting IE in &#8220;something&#8221;.
The first &#8220;something&#8221; was an exe hosting IE and adding a bunch of [...]]]></description>
			<content:encoded><![CDATA[<p>In one of my past posts, I talked a little about my impressions of Vista as a platform for software developers. Here&#8217;s the story of how I got involved with WPF.</p>
<p>My last two projects before starting on WPF were built around hosting IE in &#8220;something&#8221;.</p>
<p>The first &#8220;something&#8221; was an exe hosting IE and adding a bunch of window.external functionality. I took the lead in moving a somewhat old, pretty static UI infrastructure for presenting internet-updatable content to the XML/CSS/XSLT age. That involved a lot of using dynamic expressions to enable reflowing of the UI for different monitor sizes (the app was a fullscreen app). Towards the end of that project I started hearing about an XML-based application development thing coming from Microsoft, and I remember thinking &#8220;How cool! No more need for the mess of HTML / CSS / XSLT and JScript/dynamic expressions to glue it together.&#8221;</p>
<p> The second &#8220;something&#8221; was an application for Windows Media Center, which at the time only offered hosted IE as its application development model (with a bunch of window.external functionality thrown in to get at the Media Center stuff, similar to how our exe had worked). Three of us wrote a pretty interesting little application that shipped for about a year and then was discontinued when circumstances changed on us drastically. Around the time this happened, the XML-based app development thing from Microsoft, better known then as &#8220;Avalon&#8221;, took more shape.</p>
<p>I was lucky enough to get to experience the energy that Microsoft projected at PDC05. It felt like an explosion of enthusiasm around the newly re-christened &#8220;Windows Presentation Foundation&#8221;. My eyes were popping at Greg Schechter&#8217;s talk. Manuel Clement&#8217;s talk was chock-full infectious excitement. I wanted to work with this new stuff.</p>
<p>Luckily the project(s) we were given to work on next required a level of &#8220;polish&#8221; that I doubted we could achieve using HTML, WinForms or any other technology we were proficient in. I advocated strongly for using WPF, and for some reason management went along. One of the requirements for one of the projects was that it had to run under Vista and more specifically under Media Center to get a great user experience. The level of &#8220;polish&#8221; that was required pretty much ruled out using HTML. We could have done all ActiveX controls, I suppose, or an HTML/Flash hybrid, but none of us had the required expertise to implement that, and the time frame was extremely tight to begin with.</p>
<p>To me the only way to solve the problem was using the incredible leverage of WPF to &#8220;get things done&#8221;, even with the steep, steep initial learning curve. I worked on some throw-away applications just to show my manager that this new platform had incredible potential and that I would be able to pick it up quickly enough to work with it seriously. He liked what he saw. The rest is material for another post. Let me just say now that the devil is in the details, and we had lots of challenges on the project overall. Once it&#8217;s out there I can talk more about it, but not yet.</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=13&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_13" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2006/10/09/how-did-i-end-up-working-with-windows-presentation-foundation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The WPF developer&#8217;s toolbelt</title>
		<link>http://www.geektieguy.com/2006/10/05/the-wpf-developers-toolbelt/</link>
		<comments>http://www.geektieguy.com/2006/10/05/the-wpf-developers-toolbelt/#comments</comments>
		<pubDate>Fri, 06 Oct 2006 05:32:05 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2006/10/05/the-wpf-developers-toolbelt/</guid>
		<description><![CDATA[This is a collection of tools that should be in every WPF developer&#8217;s toolbelt, if you ask me:
XAMLPad (from the Windows SDK [Full ISO&#124;Express Web Download])Snoop (from Pete Blois)Perforator (from the Windows SDK) (Don&#8217;t forget to turn on the required debugging setting in the registry -&#160;mentioned in the article)CLR Profiler.Net Reflector (from Lutz Roeder)
If you&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p>This is a collection of tools that should be in every WPF developer&#8217;s toolbelt, if you ask me:</p>
<p>XAMLPad (from the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=117ECFD3-98AD-4D67-87D2-E95A8407FA86&amp;displaylang=en">Windows SDK</a> [<a href="http://download.microsoft.com/download/3/0/8/308525e4-3193-4308-9a65-90c57e97495f/6.0.5536.0.2.WindowsSDK_Vista_RC1.DVD.Rel.img">Full ISO</a>|<a href="http://download.microsoft.com/download/2/5/5/255a13fe-c09b-4618-8473-4de26c33bd97/Setup.exe">Express Web Download</a>])<br /><a href="http://www.blois.us/Snoop/">Snoop</a> (from <a href="http://www.blois.us/blog/">Pete Blois</a>)<br /><a href="http://windowssdk.msdn.microsoft.com/en-us/library/ms742400.aspx">Perforator</a> (from the Windows SDK) (Don&#8217;t forget to turn on the required debugging setting in the registry -&nbsp;mentioned in the article)<br /><a href="http://www.microsoft.com/downloads/details.aspx?familyid=A362781C-3870-43BE-8926-862B40AA0CD0&amp;displaylang=en">CLR Profiler</a><br /><a href="http://www.aisto.com/roeder/dotnet/">.Net Reflector</a> (from <a href="http://www.aisto.com/roeder/">Lutz Roeder</a>)</p>
<p>If you&#8217;re a designer / developer you also want:</p>
<p><a href="http://www.microsoft.com/products/expression/en/interactive_designer/id_free_trial.aspx">Microsoft Expression</a>: <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=EBF7A3F3-4B55-4C2C-A43A-B977446A131A&amp;displaylang=en">Interactive Designer</a><br /><a href="http://www.mobiform.com/Eng/aurora.html">MOBIFORM Aurora XAML Designer</a><br /><a href="http://www.erain.com/Products/ZAM3D/DefaultPDC.asp">Electric Rain Zam3D</a></p>
<p>And of course the staples:</p>
<p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c6636e90-26e6-44e0-8780-5d3ccd3d94ed&amp;DisplayLang=en">.Net Framework 3.0 September 2006 CTP</a>&nbsp;(I usually pick the complete installer to avoid download problems - it&#8217;s hidden a few paragraphs down under a link that says &#8220;for x86&#8243;)<br />Visual Studio 2005 / <a href="http://msdn.microsoft.com/vstudio/express/">Visual Studio 2005 Express</a><br /><a href="http://www.microsoft.com/downloads/details.aspx?familyid=935AABF9-D1D0-4FC9-B443-877D8EA6EAB8&amp;displaylang=en">&#8220;Cider&#8221; / &#8220;Orcas Preview for WPF&#8221;</a></p>
<p>Did I miss anything?</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=19&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_19" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2006/10/05/the-wpf-developers-toolbelt/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Vista from a developer&#8217;s point of view</title>
		<link>http://www.geektieguy.com/2006/09/09/vista-from-a-developers-point-of-view/</link>
		<comments>http://www.geektieguy.com/2006/09/09/vista-from-a-developers-point-of-view/#comments</comments>
		<pubDate>Sun, 10 Sep 2006 01:05:26 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[Vista]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2006/09/09/vista-from-a-developers-point-of-view/</guid>
		<description><![CDATA[To me Windows Vista marks a great new milestone for software developers. Not just because Microsoft invested years of development into a new programming framework, but because that framework will be included out of the box. Until now, if you wanted to take advantage of the power of the .Net Framework (1.0, 1.1 and 2.0) [...]]]></description>
			<content:encoded><![CDATA[<p>To me Windows Vista marks a great new milestone for software developers. Not just because Microsoft invested years of development into a new programming framework, but because that framework will be <em>included out of the box</em>. Until now, if you wanted to take advantage of the power of the .Net Framework (1.0, 1.1 and 2.0) you had to either include the installer for the framework or create some other magic to get it on the user&#8217;s system (asking the user to please, please download and install it first?)</p>
<p>With Vista, not only do you get the .Net Framework 2.0 (much improved over the previous versions) in the box, but also the amazingly powerful Windows Presentation Foundation (which is what I&#8217;ve worked with), Windows Communication Foundation and Windows Workflow Foundation (two pieces I know nothing about yet).</p>
<p>This will lower the barrier to entry for applications developed using these powerful tools to zero. As long as you&#8217;re writing your application for Vista you can be sure the basic requirements are there.</p>
<p>There will be issues with certain features of WPF (rendering in software vs. hardware, especially for 3D), but the framework helps you detect these issues and makes it possible to adapt your application to lower its &#8220;flashyness&#8221; (RenderCapability.Tier, remember this needs to be shifted down by 16 bits if you want to use 0, 1 and 2 as the human readable values).</p>
<p>To me Windows Presentation Foundation is the most important technology to come out of Microsoft for a long time. I&#8217;ve never written too much actual Win32 or even MFC/ATL UI code for client applications, but I&#8217;ve done a lot of HTML / CSS stuff and pure business object stuff (COM/ATL). More about that in my next post. I don&#8217;t want this to get too long.</p>
<p> </p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=12&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_12" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2006/09/09/vista-from-a-developers-point-of-view/feed/</wfw:commentRss>
		</item>
		<item>
		<title>.Net Framework 3.0 RC1 issue with RenderCapability.Tier on Windows XP</title>
		<link>http://www.geektieguy.com/2006/09/05/net-framework-30-rc1-issue-with-rendercapabilitytier-on-windows-xp/</link>
		<comments>http://www.geektieguy.com/2006/09/05/net-framework-30-rc1-issue-with-rendercapabilitytier-on-windows-xp/#comments</comments>
		<pubDate>Tue, 05 Sep 2006 18:58:05 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2006/09/05/net-framework-30-rc1-issue-with-rendercapabilitytier-on-windows-xp/</guid>
		<description><![CDATA[I discovered that
System.Windows.Media.RenderCapability.Tierreported a wrong tier (zero) after I upgraded my Windows XP dev box&#8217;s .Net Framework 3.0 installation to the RC1 release. My card used to be a tier two and I had just upgraded the drivers, too. I contacted Microsoft about it and they said this is a known issue with the RC1 [...]]]></description>
			<content:encoded><![CDATA[<p>I discovered that</p>
<p><font size="2"></font><font size="2">System.Windows.Media.</font><font color="#008080" size="2">RenderCapability</font>.Tier<font size="2"></font><font size="2">reported a wrong tier (zero) after I upgraded my Windows XP dev box&#8217;s .Net Framework 3.0 installation to the RC1 release. My card used to be a tier two and I had just upgraded the drivers, too. I contacted Microsoft about it and they said this is a known issue with the RC1 release and that it will be fixed in the upcoming RTM release.</font><font size="2"> </font><font size="2">The problem is <strong>only with this particular API</strong> and <strong>only happens on Windows XP</strong>. All the actual rendering is still done correctly based on the capabilities of the hardware. So the only problem is if your WPF application is built to behave differently based on the value of this API call.</font><font size="2">There is a workaround that has to do with changing the value type of a certain registry entry (the video memory size) from Binary to DWORD. I&#8217;ll point to more details once I get a URL from Microsoft to point to.</p>
<p><strong>Update:</strong> Here&#8217;s the link to the official release notes for this problem:</p>
<p><span style="font-size: 11pt; color: #1f497d; font-family: 'Calibri','sans-serif'"><a title="http://msdn.microsoft.com/windowsvista/support/relnotes/netfxRc1/default.aspx#topic6" href="http://msdn.microsoft.com/windowsvista/support/relnotes/netfxRc1/default.aspx#topic6">http://msdn.microsoft.com/windowsvista/support/relnotes/netfxRc1/default.aspx#topic6</a> </p>
<p></span>Also, I need to correct my statement about this only happening on XP. That&#8217;s not entirely correct. It happens with XPDM drivers, which you can have on Vista as well. It&#8217;s just more likely that you have XPDM drivers on XP.</p>
<p></font> </p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=9&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_9" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2006/09/05/net-framework-30-rc1-issue-with-rendercapabilitytier-on-windows-xp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CompositionTarget.Rendering can be a CPU hog</title>
		<link>http://www.geektieguy.com/2006/08/23/compositiontargetrendering-can-be-a-cpu-hog/</link>
		<comments>http://www.geektieguy.com/2006/08/23/compositiontargetrendering-can-be-a-cpu-hog/#comments</comments>
		<pubDate>Thu, 24 Aug 2006 04:12:43 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2006/08/23/compositiontargetrendering-can-be-a-cpu-hog/</guid>
		<description><![CDATA[I ran into an issue where my WPF application would consume about 20% of CPU time just sitting idle on a Page. A question from Tim Sneath led me to investigate an aspect of the app that uses the CompositionTarget.Rendering callback to do some animations that can&#8217;t be done in other ways in WPF right [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into an issue where my WPF application would consume about 20% of CPU time just sitting idle on a Page. A question from <a href="http://blogs.msdn.com/tims" target="_blank">Tim Sneath</a> led me to investigate an aspect of the app that uses the CompositionTarget.Rendering callback to do some animations that can&#8217;t be done in other ways in WPF right now.</p>
<p>I had several UIElements that each had the Rendering event hooked up, and the code in the event handler would do next to nothing most of the time, since the animation only was kicked off on a mouse up event. I modified the code, so that the event hookup doesn&#8217;t happen until the mouse up event comes in, and also so that an unhook happens when the animation is finished. This promptly took down the CPU load to the typical intermittent 1-2%.</p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=6&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_6" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2006/08/23/compositiontargetrendering-can-be-a-cpu-hog/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Remember to unhook those event handlers!</title>
		<link>http://www.geektieguy.com/2006/08/07/remember-to-unhook-those-event-handlers/</link>
		<comments>http://www.geektieguy.com/2006/08/07/remember-to-unhook-those-event-handlers/#comments</comments>
		<pubDate>Mon, 07 Aug 2006 22:13:43 +0000</pubDate>
		<dc:creator>GeekTieGuy</dc:creator>
		
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.geektieguy.com/2006/08/07/remember-to-unhook-those-event-handlers/</guid>
		<description><![CDATA[I thought I&#8217;d make my first post not just a &#8220;hello out there&#8221;, but something that&#8217;s marginally useful to some people. 
If you&#8217;re writing a Windows Presentation Foundation app that has just a little bit of complexity to it, you may do things like hook up UI Elements to event handlers. This could be for navigation, reacting [...]]]></description>
			<content:encoded><![CDATA[<p>I thought I&#8217;d make my first post not just a &#8220;hello out there&#8221;, but something that&#8217;s marginally useful to some people. </p>
<p>If you&#8217;re writing a Windows Presentation Foundation app that has just a little bit of complexity to it, you may do things like hook up UI Elements to event handlers. This could be for navigation, reacting to data changes, timers etc.</p>
<p>An important thing to remember is to unhoook those event handlers when your UI Element is unloaded. Otherwise the event handler hangs on to the visual tree and the garbage collector will not let go of it. This results in memory consumption &#8220;problems&#8221;, which is a nice word for a &#8220;managed memory leak&#8221;.</p>
<p>So if you do something like this:</p>
<p>public MyElement()<br />
{<br />
  InitializeComponent();<br />
  Loaded += new EventHandler(OnLoaded);<br />
}</p>
<p>public void OnLoaded(object sender, EventArgs e)<br />
{<br />
  myTimer.Tick += new EventHandler(OnTick);<br />
}</p>
<p>Don&#8217;t forget to also hook the Unloaded event and do this in it:</p>
<p>public void Unloaded(object sender, EventArgs e)<br />
{<br />
  myTimer.Tick -= new EventHandler(OnTick);<br />
}</p>
<p> </p>
<p class="akst_link"><a href="http://www.geektieguy.com/?p=3&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_3" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.geektieguy.com/2006/08/07/remember-to-unhook-those-event-handlers/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
