<?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>Design with Silverlight</title>
	<atom:link href="http://designwithsilverlight.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://designwithsilverlight.com</link>
	<description>Silverlight... you're soaking in it.</description>
	<pubDate>Wed, 24 Feb 2010 18:57:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Things I learned from my dad</title>
		<link>http://designwithsilverlight.com/2010/02/24/things-i-learned-from-my-dad/</link>
		<comments>http://designwithsilverlight.com/2010/02/24/things-i-learned-from-my-dad/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 18:57:39 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<guid isPermaLink="false">http://designwithsilverlight.com/?p=195</guid>
		<description><![CDATA[
My father passed away unexpectedly on January 31st, 2010. In the time since he slipped away, I've spent a lot of time thinking about a lot of things - work, family, life, etc. I am still processing what has happened, and I'm not sure how long it will take before I understand the full impact [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: Georgia,serif; font-size: x-small;"></p>
<div style="margin-top: 5pt; margin-bottom: 5pt;">My father passed away unexpectedly on January 31st, 2010. In the time since he slipped away, I've spent a lot of time thinking about a lot of things - work, family, life, etc. I am still processing what has happened, and I'm not sure how long it will take before I understand the full impact this change has had on me, or even if I ever will. One thing I appreciated about my dad was his life experiences and what they meant to me growing up. I thought I'd take an opportunity to share a few "life lessons" from those experiences:</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">1. My dad loved photography. He had an old Olympus OM-2 film camera he used while I was growing up. He had a lot of slides... probably thousands. Vacations, random shots of people, conferences he attended and cool experiments like double exposures and fast shutter times to stop motion. He had gotten into digital cameras over the last few years and carried on shooting with a nice prosumer Fuji.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">Recently, he had poured a lot of effort into digitizing the old slides and cleaning them up in order to preserve them. As I was going through them, I found a lot of pictures I had forgotten. My dad was usually the one behind the camera, but in probably 80% or more of the photos in which he appeared, he was holding a fish or was in the process of fishing.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">The lesson: Take a lot of pictures. If you're in them, smile. This is how people will remember/see you when you're gone.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">2. My dad liked to write and speak. He led a lot of technical sessions throughout his career and loved teaching people new things. I remember once when I was in 3rd grade he came and spoke to my classroom. Here's a guy teaching mainframe computing and timesharing to a bunch of 3rd graders, and the class was eating it up. He also brought swag - he knew his audience.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">While I was helping to clean up his office I found a lot of his notebooks. Some were very old, from when he was a teen. Some were very recent. All of them contained ideas. Ideas for books, ideas for businesses, ideas for people.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">The lesson: Write. People who didn't know you closely will feel close to you when they know your thoughts.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">3. My dad had an interest in flying. He loved to fly, even if it was for work. He decided to get his private pilot's license in the early 80s. After he got it, I went up with him a few times in both a Cessna 152 and 172. He used to love to tell a story about when he was flying with an instructor and was first learning how to land - he brought the plane in smoothly, and the wheels "kissed the runway". As they taxied back, the instructor yelled at him - he had come in too fast, wrong angle, etc.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">The lesson: You might think the lesson here is that any landing you can walk away from would be considered a good one, but I think it's more than that. Good landings are a matter of perspective, and they are what you make them - be prepared, and your wheels will almost always kiss the runway.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">4. My dad had an incredible sense of humor. He could find something funny in almost any situation. I remember sitting around the dinner table once with my dad and two sisters while he told a joke. It was a joke that was clearly not entirely intended for kids, but nothing too far out of bounds. My dad built up the joke, and delivered the punch line. He laughed and laughed. My sisters and I stared at each other trying to figure out what was so funny.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">The lesson: Seems obvious, but has to be said. Laugh. We've told so many stories about my dad and had those same laughing fits because that's how <em>he</em> was, and that's what <em>he</em> would have wanted. Laugh a lot so people can laugh with you after you're gone.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">5. One thing my dad was always good at was brightening somebody's day. Whether it's a joke, sharing a story, listening, etc., you could count on that time and it would make things a little better. After he passed away, I was talking to one of his neighbors, who told me he thought my dad was a good guy. My dad was outside one day and saw the neighbor's son outside. He knew that the kid rode a dirt bike, so he went over there, gave him $20 and told him to get gas and take the bike for a spin. I've heard a lot of stories like this over the past few weeks, from different people.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">The lesson: It's the little things. Take care of the people around you - little things mean a lot to a lot of people.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">6. As I alluded to earlier, my dad loved to fish. I took him on a sturgeon charter out in Astoria, Oregon one time, and he snapped a rod in half on a fish. To hear him tell the story, you'd have thought he had hooked Moby Dick.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">One thing he used to do was take a week off and go fishing up in Canada with a bunch of "the guys". They went to a place called <a href="http://www.jimscaviarcamp.com/"><span style="color: #0000ff;"><span style="text-decoration: underline;">Jim's Caviar Camp</span></span></a>. They would go out with a guide during the day, but were allowed to use the boats to go back out after dinner. My dad hopped in a boat one evening after dinner and headed out to catch a few more fish. He wasn't paying attention to the time, and suddenly realized it was dark and that there was no hope of finding his way back to camp. He found a clearing and pulled the boat ashore. He prepared himself to spend the night - a burlap sack for a blanket and fillet knife by his side in case a bear decided to make an appearance (he wasn't going to go down without a fight). He lay on the shore as the Northern Lights danced over head.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">In the distance, he heard the faint sound of a motorboat - they had come looking for him. He looked for something with which to signal, and found the only thing he had - his Bic lighter. He held it up and lit it, and was immediately seen by the search party in the boat. They said that in the darkness, it looked like the island was on fire.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">After that, my dad <em>always</em> carried a lighter in his tackle box. He quit smoking over 20 years ago and <em>still</em> carried a lighter.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">The lesson: Find your lighter. Who or whatever it may be. You never know when you'll be unexpectedly surrounded by darkness.</div>
<div style="margin-top: 5pt; margin-bottom: 5pt;">My dad was mine.</div>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://designwithsilverlight.com/2010/02/24/things-i-learned-from-my-dad/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Adaptive Streaming with Encoder 3</title>
		<link>http://designwithsilverlight.com/2009/10/14/using-adaptive-streaming-with-encoder-3/</link>
		<comments>http://designwithsilverlight.com/2009/10/14/using-adaptive-streaming-with-encoder-3/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 17:59:18 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
		
		<category><![CDATA[Tutorial]]></category>

		<category><![CDATA[adaptive streaming]]></category>

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

		<category><![CDATA[smooth streaming]]></category>

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

		<guid isPermaLink="false">http://designwithsilverlight.com/?p=184</guid>
		<description><![CDATA[We've been digging in to adaptive streaming pretty deeply as of late, and it's been an interesting learning experience. Words cannot express how much I love what adaptive streaming does for video on the Internet. I have felt since I first saw it that it will change the way we all watch video online, and [...]]]></description>
			<content:encoded><![CDATA[<p>We've been digging in to adaptive streaming pretty deeply as of late, and it's been an interesting learning experience. Words cannot express how much I love what adaptive streaming does for video on the Internet. I have felt since I first saw it that it will change the way we all watch video online, and we're seeing that start to happen.</p>
<p>After working with it for just a couple of projects, I cannot see ever going back to a WMV source file. They just seem so... <i>small</i>. In contrast, I've been able to deliver multiple concurrent full browser 720p videos without killing the systems on which they are running. The videos start immediately, are more scalable, and just look better - this provides a much better user experience than the old "buffering" animation while you're waiting for content.</p>
<p>The basic process of getting adaptive streaming up and running wasn't too bad, once we figured out a hosting solution. We've had an account at Limelight for quite some time, and although they were telling us they supported adaptive streaming, when push came to shove, it turns out they really don't. It was always "just around the corner".</p>
<p>We did a little digging and found a local hosting provider here in Portland that fully supports adaptive streaming and is a Microsoft Gold Certified partner. We had been using them for a while for various hosting needs, and they have really stellar support - if you're looking for an inexpensive adaptive streaming solution, check out <a href="http://www.opusinteractive.com/" target="_blank">Opus Interactive</a>. They know what they're doing and can get it set up fast!</p>
<p>Our early smoke tests worked out pretty well. We used some various example code we found online to access some existing smooth streaming content. The process was pretty straightforward:</p>
<p>1) Add a reference to the SmoothStreaming.dll in your application</p>
<p>2) Add</p>
<pre class="csharp"><span style="color: #0600FF;">using</span> Microsoft.<span style="color: #0000FF;">Expression</span>.<span style="color: #0000FF;">Encoder</span>.<span style="color: #0000FF;">AdaptiveStreaming</span>;</pre>
<p>to your usings.</p>
<p>3) Create a new adaptive streaming source:</p>
<pre class="csharp">    AdaptiveStreamingSource MainSrc =
        <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> AdaptiveStreamingSource<span style="color: #000000;">&#40;</span>MainVideo, <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Uri
            <span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;http://video3.smoothhd.com/ondemand/Got_Imagination_(California).ism/Manifest&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</pre>
<p>4) Assign the AdaptiveStreamingSource to your media element:</p>
<pre class="csharp">    MainVideo.<span style="color: #0000FF;">SetSource</span><span style="color: #000000;">&#40;</span>MainSrc<span style="color: #000000;">&#41;</span>;</pre>
<p>Note that in step 3, we're pointing to the base file that Encoder 2 produced, and adding "/manifest" to the URI string. There is no file called "manifest" - you're telling the server which file to use as the manifest. The file being used as the manifest is an XML file that describes the available video and audio streams.</p>
<p>Fire up your application and you're good to go. We were able to read test streams from smoothhd.com and also had success in placing the Big Buck Bunny demo on our own hosting provider and pointing to that.</p>
<p>Life is good, until....</p>
<p>In creating some test streams for an application we were building, we starting running into trouble. Strangely, the code had worked fine for an application we just built, but broke on the very next application we worked on. The application was tossing out errors about reading the manifest file.</p>
<p>We did some digging and the root cause of the problem is that with Encoder 3, the format of the manifest file has changed. We had outsourced the encoding of the videos for the earlier project, and they had obviously utilized Encoder 2, which is why the code worked the first time through.</p>
<p>The change in the manfiest file format is no problem at all if you are using the Silverlight template from Encoder, because the libraries were updated there. However, if you have written a custom solution, you're going to need to update your code. This is both a good thing and a bad thing. It takes a little more code to make the streams go, but there appears to be a lot more stuff you can control.</p>
<p>Thankfully, it turns out not to be too difficult (in hindsight) to utilize the Encoder 3 adaptive streaming output in your own code, and the new libraries are also backwards compatible with the Encoder 2 manifest file format, so any existing streams you have encoded will not need to be re-encoded.</p>
<p>Here's how to use adaptive streaming with files encoded with Encoder 3:</p>
<p>1) Start by navigating to your Encoder 3 folder with Windows Explorer. On my systems, the path is:<br />
C:\Program Files\Microsoft Expression\Encoder 3\Templates\en</p>
<p>2) The template you want is called "Graphing". In that folder, you will find a Silverlight application (XAP) file called "SmoothStreaming.xap". Change the extension to .zip, and open the archive up. You want to extract both the "PlugInMssCtrl.dll", and "SmoothStreaming.dll" libraries for use in your own projects.</p>
<p>3) In your application, right-click the project References, and pick "Add Reference". Locate and add both libraries.</p>
<p>4) Add</p>
<pre class="csharp"><span style="color: #0600FF;">using</span> Microsoft.<span style="color: #0000FF;">Expression</span>.<span style="color: #0000FF;">Encoder</span>.<span style="color: #0000FF;">AdaptiveStreaming</span>;</pre>
<p>to your usings.</p>
<p>5) Next (you can code these however you'd like, this way just suited my needs), create variables for your video URI and AdaptiveStreamingSource:</p>
<pre class="csharp">        <span style="color: #0600FF;">private</span> <span style="color: #FF0000;">string</span> uriString = <span style="color: #808080;">&quot;http://video3.smoothhd.com/ondemand/Got_Imagination_(California).ism/Manifest&quot;</span>;
        <span style="color: #0600FF;">private</span> AdaptiveStreamingSource MainSrc = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> AdaptiveStreamingSource<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</pre>
<p>6) Now here's where it changes a bit. The AdaptiveStreamingSource has a MediaElement property, which needs to be assigned to your MediaElement:</p>
<pre class="csharp">MainSrc.<span style="color: #0000FF;">MediaElement</span> = MainVideo;</pre>
<p>This is flipped from how it worked before. In the earlier example, the video source was set to the AdaptiveStreamingSource. Now, the AdaptiveStreamingSource has a MediaElement associated with it.</p>
<p>7) The AdaptiveStreamingSource also needs the location of the manifest file:</p>
<pre class="csharp">MainSrc.<span style="color: #0000FF;">ManifestUrl</span> = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Uri<span style="color: #000000;">&#40;</span>uriString<span style="color: #000000;">&#41;</span>;</pre>
<p>8&#41; Finally, you can set up an event listener for "MainSrc.MediaElement.Loaded", and play the video once it has been loaded with the following code:</p>
<pre class="csharp">MainSrc.<span style="color: #0000FF;">StartPlayback</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</pre>
<p>That should get the video going for you. I've run into a few quirks using the adaptive streams. The most troublesome was a "MediaEnded" event on a particular video that was raising 10 seconds or more before my video ended. This made it impossible for me to reset the state of the application when the video I was playing finished on its own. Still, that is a relatively minor issue that is easy to work around.</p>
<p>If you're interested in an example that uses this code, I've placed one online that you can <a href="http://designwithsilverlight.com/silverlight_3/AdaptiveStreaming/AdaptiveStreamingExample.zip">download</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://designwithsilverlight.com/2009/10/14/using-adaptive-streaming-with-encoder-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Silverlight MVP</title>
		<link>http://designwithsilverlight.com/2009/10/08/silverlight-mvp/</link>
		<comments>http://designwithsilverlight.com/2009/10/08/silverlight-mvp/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 20:53:34 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
		
		<category><![CDATA[Main]]></category>

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

		<guid isPermaLink="false">http://designwithsilverlight.com/?p=187</guid>
		<description><![CDATA[On October 1st, I received an email notifying me that I had earned a Microsoft MVP award in Silverlight. Wanted to take a moment and say thanks to those that nominated me, the people that bought my books, etc. I appreciate the significance of the award and what it means at both a professional and [...]]]></description>
			<content:encoded><![CDATA[<p>On October 1st, I received an email notifying me that I had earned a Microsoft MVP award in Silverlight. Wanted to take a moment and say thanks to those that nominated me, the people that bought my books, etc. I appreciate the significance of the award and what it means at both a professional and community level.</p>
<p>It's been so amazing to see how far the technology has advanced in such a short period of time, and to be able to be involved in that has been exciting. Looking forward to seeing where it continues to lead us.</p>
]]></content:encoded>
			<wfw:commentRss>http://designwithsilverlight.com/2009/10/08/silverlight-mvp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Adventures in Silverlight 3 Multi-touch, Part I</title>
		<link>http://designwithsilverlight.com/2009/08/17/adventures-in-silverlight-3-multi-touch-part-i/</link>
		<comments>http://designwithsilverlight.com/2009/08/17/adventures-in-silverlight-3-multi-touch-part-i/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 03:31:39 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
		
		<category><![CDATA[Tutorial]]></category>

		<category><![CDATA[multi-touch]]></category>

		<category><![CDATA[Silverlight 3]]></category>

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

		<guid isPermaLink="false">http://designwithsilverlight.com/?p=177</guid>
		<description><![CDATA[After reading a recent blog post from Tim Heuer that covers Silverlight 3 multi-touch, I got my interest piqued. I had wanted to play around with multi-touch computing for a while, and it seems like Silverlight 3 just dropped an affordable way to do that right into my lap. The next few blog posts I [...]]]></description>
			<content:encoded><![CDATA[<p>After reading a recent <a target="_blank" href="http://timheuer.com/blog/archive/2009/07/30/silverlight-3-multi-touch-introduction-fundamentals-basics.aspx">blog post</a> from Tim Heuer that covers Silverlight 3 multi-touch, I got my interest piqued. I had wanted to play around with multi-touch computing for a while, and it seems like Silverlight 3 just dropped an affordable way to do that right into my lap. The next few blog posts I do will cover my experiments with Silverlight 3 multi-touch.</p>
<p>In his blog, Tim covered the type of system he was using. I decided to go with something bigger, thinking it would simulate an interactive kiosk-type experience. That led me to the <a target="_blank"  href="http://www.frys.com/product/5805863;jsessionid=o3gl--EASxkRXnNYDDDD8Q**.node2?site=sr:SEARCH:MAIN_RSLT_PG">HP TouchSmart IQ526</a>. This is the all-in-one machine with a big 22" touch screen.</p>
<p>Of course, it comes with Vista pre-installed. Windows 7 is needed to work with multi-touch, so my first task was to download and install Win7, and any necessary patches. I also grabbed software I would need for development, such as the Express Edition of Visual Studio. I figured I would stub out the programs in Visual Studio on my main laptop, and then tweak the touch functionality on the HP. I also grabbed Firefox and a couple of other tools.</p>
<p>It took me a while to get all the software installed, but as it was installing, I wrote up a test program on my main system. Once I got the system software updated, I tested the touch functionality. Windows 7 comes with an updated version of Paint that is multi-touch enabled. My son absolutely loved it:</p>
<div id="attachment_180" class="wp-caption aligncenter" style="width: 310px"><a target="_blank" href="http://designwithsilverlight.com/wp-content/uploads/2009/08/nicktouchsmartbig.jpg"><img src="http://designwithsilverlight.com/wp-content/uploads/2009/08/nicktouchsmartbig-300x225.jpg" alt="Nick using Win7 Paint on the TouchSmart\&#039;s roomy 22\&quot; screen." title="nicktouchsmartbig" width="300" height="225" class="size-medium wp-image-180" /></a><p class="wp-caption-text">Nick using Win7 Paint</p></div>
<p>After letting him do his thing for a bit, I finally got my turn on the system. Excitedly, I opened up Firefox and opened my application. Touched the screen, but nothing happened. Maybe I missed? Tried again, but no luck. Tried Tim's test program - same result. Nothing. After consulting with Tim a bit, there wasn't a real definitive answer as to why the system wasn't registering the touches. I didn't want to get stuck with an expensive 22" paperweight, so I made the decision to revert the system and return it, and instead picked up a system from the same line Tim was using. I ended up with a <a target="_blank" href="http://www.frys.com/product/5941304?site=sr:SEARCH:MAIN_RSLT_PG">TouchSmart TX2-1270us</a>.</p>
<p>As you would expect, the new system had Vista installed out of the box. Two things really hit me. 1) shoot, I really do have to reinstall all that stuff again, and 2) wow, that screen is TINY. At any rate, I was not deterred, so I started the installs over again. For this system, there were some updated (albeit beta) touch drivers from <a target="_blank" href="http://n-trig.com/">N-trig</a>, the folks behind the touch technology on this system.</p>
<p>The installations finished up, and once again, I was at the moment of truth. I just *knew* it was going to work this time, so I excitedly launched Firefox and opened up my demo project. Touched the screen again, and.... nothing. Tried Tim's demo project, and.... nothing. In the middle of further email-based consultation with Tim, a thought occurred to me as to what the problem may be. I closed Firefox, and opened IE instead. Touched the screen, and there was the touch indicator. As it turns out, the public version of Windows 7 (build 7100) has a glitch that prevents the touchpoints from working in Firefox. </p>
<p>Now, I know what you're thinking, and while it didn't hit me immediately, I did wake up in the middle of the night in a cold sweat wondering if I had tried IE on the big 22" HP. I really don't know, but I'm not inclined to try and find out. For the record, the MSDN release of Windows 7 corrects this problem, but alas, I don't have an MSDN sub, so I am on build 7100 for the time being.</p>
<p>At any rate, the small laptop is very light, very portable, and very usable. It won't serve the purpose if we wanted to do an interactive touch kiosk in a retail space, for example, but for working through Silverlight 3's multi-touch functionality, it does the job.</p>
<p>I have written a few applications that use multi-touch, and the next few blog posts will describe the applications and how they work. Nothing fancy, mind you, but enough to dip into it and get a feel for how things work.</p>
<p>One thing that is immediately obvious is that touch is such a natural way of computing - you don't have to explain to a 4-year old how to use it. They just "get" it immediately. It also becomes habitual quickly - I sometimes find myself poking the screen on my Dell and then wondering why the computer just sits there staring back at me. And then I realize it's not a touch screen and I get mad because now I have fingerprints to clean off the screen. </p>
<p>I really think there is an opportunity here to deliver some really cool content over the web via Silverlight 3... now it's up to us as developers to find useful and interesting ways to implement touch.</p>
]]></content:encoded>
			<wfw:commentRss>http://designwithsilverlight.com/2009/08/17/adventures-in-silverlight-3-multi-touch-part-i/feed/</wfw:commentRss>
		</item>
		<item>
		<title>We now return to our regularly scheduled program&#8230;.</title>
		<link>http://designwithsilverlight.com/2009/07/31/we-now-return-to-our-regularly-scheduled-program/</link>
		<comments>http://designwithsilverlight.com/2009/07/31/we-now-return-to-our-regularly-scheduled-program/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 03:16:28 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<guid isPermaLink="false">http://designwithsilverlight.com/?p=173</guid>
		<description><![CDATA[Hey, remember me? =)
I realize it's been fairly quiet on my blog for a while. I'm happy to tell you that it's because I was working through an update to my book, which is now finished. Foundation Silverlight 3 Animation has shipped to the printer, and should be available near the end of August. Here's [...]]]></description>
			<content:encoded><![CDATA[<p>Hey, remember me? =)</p>
<p>I realize it's been fairly quiet on my blog for a while. I'm happy to tell you that it's because I was working through an update to <a target="_blank" href="http://www.amazon.com/Foundation-Silverlight-Animation-Jeff-Paries/dp/143022407X/ref=sr_1_3?ie=UTF8&qid=1249096373&sr=8-3">my book</a>, which is now finished. Foundation Silverlight 3 Animation has shipped to the printer, and should be available near the end of August. Here's a peek at the cover:</p>
<p><a href="http://designwithsilverlight.com/wp-content/uploads/2009/07/fsl3a_cover.jpg"><img src="http://designwithsilverlight.com/wp-content/uploads/2009/07/fsl3a_cover-300x171.jpg" alt="Foundation Silverlight 3 Animation cover image" title="fsl3a_cover" width="300" height="171" class="size-medium wp-image-174" /></a></p>
<p><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br />
Hoping to get back to posting tutorials and tips soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://designwithsilverlight.com/2009/07/31/we-now-return-to-our-regularly-scheduled-program/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Silverlight 3 Photo Gallery Wall Application</title>
		<link>http://designwithsilverlight.com/2009/03/31/silverlight-3-photo-gallery-wall-application/</link>
		<comments>http://designwithsilverlight.com/2009/03/31/silverlight-3-photo-gallery-wall-application/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 04:22:52 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
		
		<category><![CDATA[Tutorial]]></category>

		<category><![CDATA[bitmap effect]]></category>

		<category><![CDATA[gallery wall]]></category>

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

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

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

		<category><![CDATA[Silverlight 3]]></category>

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

		<guid isPermaLink="false">http://designwithsilverlight.com/?p=162</guid>
		<description><![CDATA[Hard to believe that it's been about a year and a half since I wrote the Photo Gallery Wall application in Silverlight 1.0. I've gotten quite a few emails requesting a C# version of the application, and while I did give permission for it to get translated into C#/Silverlight 2 (an effort that was completed [...]]]></description>
			<content:encoded><![CDATA[<p>Hard to believe that it's been about a year and a half since I wrote the <a href="http://designwithsilverlight.com/tutorials/photoGalleryWall/Default.html">Photo Gallery Wall </a>application in Silverlight 1.0. I've gotten quite a few emails requesting a C# version of the application, and while I did give permission for it to get translated into C#/Silverlight 2 (an effort that was completed just a few weeks ago), Silverlight 3 is the release I was waiting on to do an update.</p>
<p>Why wait? Silverlight 3 saved me a lot of trouble - the bitmap effects make perfect drop shadows with nice, soft edges, no imperfectly-shaped paths or duplicate text fields. I also get perspective transforms, so now I can build out the panels along a flat plane, and rotate the entire panel into 3D. One more new feature I used was the ImageCompleted event. No more image "popping" when a storyboard starts before an image is fully loaded.</p>
<p>The default view of the application is a gallery with 16 images in it:</p>
<div id="attachment_167" class="wp-caption alignnone" style="width: 310px"><a href="http://designwithsilverlight.com/wp-content/uploads/2009/03/gallerywall_main1.jpg"><img class="size-medium wp-image-167" title="gallerywall_main1" src="http://designwithsilverlight.com/wp-content/uploads/2009/03/gallerywall_main1-300x196.jpg" alt="Gallery Wall Main View" width="300" height="196" /></a><p class="wp-caption-text">Gallery Wall Main View</p></div>
<p>If no action is taken, the gallery will cycle through the images. If you select a thumbnail on the left, the image is displayed on the panel on the right for 20 seconds before the slideshow is resumed. If you would like a closer look at an image while the slideshow is running, you can click the image on the right and the panel will animate to an alternate view as shown following:</p>
<div id="attachment_168" class="wp-caption alignnone" style="width: 310px"><a href="http://designwithsilverlight.com/wp-content/uploads/2009/03/gallerywall_alternate1.jpg"><img class="size-medium wp-image-168" title="gallerywall_alternate1" src="http://designwithsilverlight.com/wp-content/uploads/2009/03/gallerywall_alternate1-300x196.jpg" alt="Gallery Wall Alternate View" width="300" height="196" /></a><p class="wp-caption-text">Gallery Wall Alternate View</p></div>
<p>If you have Silverlight 3 installed, the completed app can be seen <a href="http://designwithsilverlight.com/silverlight_3/galleryWall/" target="_blank">here</a>. Since the code is available at the end of this post, I figured I'd hit on a few points from the application, and let you dig up the rest if you're so inclined.</p>
<p><strong>Reflections</strong><br />
My first approach with the application was to insert the images as object instances, so I could use just one object. However, since I had the element binding available to me, I decided to go the long way and actually create each image element to take some of the new features for a spin. This was done by creating a Canvas, and then placing an Image and Rectangle element inside. The Image element is used to hold the thumbnail, and the Rectangle element is used for a stroke highlight when the mouse is over the selected thumbnail. Notice that the image has a DropShadow effect on it.</p>
<pre class="csharp">&nbsp;
&lt;Canvas x:Name=<span style="color: #808080;">&quot;canvas&quot;</span> Grid.<span style="color: #0000FF;">Row</span>=<span style="color: #808080;">&quot;0&quot;</span> Grid.<span style="color: #0000FF;">Column</span>=<span style="color: #808080;">&quot;0&quot;</span> Opacity=<span style="color: #808080;">&quot;0&quot;</span>&gt;
	&lt;Image x:Name=<span style="color: #808080;">&quot;ImageTile_00&quot;</span> Source=<span style="color: #808080;">&quot;images/msh640x480.jpg&quot;</span>
                        Opacity=<span style="color: #808080;">&quot;1&quot;</span> Width=<span style="color: #808080;">&quot;120&quot;</span> Height=<span style="color: #808080;">&quot;93&quot;</span> Margin=<span style="color: #808080;">&quot;5,5,0,0&quot;</span>
                        Stretch=<span style="color: #808080;">&quot;Fill&quot;</span> Cursor=<span style="color: #808080;">&quot;Hand&quot;</span>&gt;
		&lt;Image.<span style="color: #0000FF;">Effect</span>&gt;
			&lt;DropShadowEffect Opacity=<span style="color: #808080;">&quot;0.6&quot;</span> ShadowDepth=<span style="color: #808080;">&quot;3&quot;</span>/&gt;
		&lt;/Image.<span style="color: #0000FF;">Effect</span>&gt;
	&lt;/Image&gt;
	&lt;Rectangle x:Name=<span style="color: #808080;">&quot;StrokeHighlight_00&quot;</span> Width=<span style="color: #808080;">&quot;120&quot;</span>
              Height=<span style="color: #808080;">&quot;93&quot;</span> Stroke=<span style="color: #808080;">&quot;#FFFFBA00&quot;</span> Opacity=<span style="color: #808080;">&quot;0&quot;</span>
              Margin=<span style="color: #808080;">&quot;5,5,0,0&quot;</span> StrokeThickness=<span style="color: #808080;">&quot;2&quot;</span>/&gt;
&lt;/Canvas&gt;
&nbsp;</pre>
<p>Each of the thumbnail images is duplicated in the reflections container, and bound to its counterpart using the element to element binding of Silverlight 3. The code for the reflections container that matches the image container shown above looks like this:</p>
<pre class="csharp">&nbsp;
&lt;Canvas x:Name=<span style="color: #808080;">&quot;Reflection&quot;</span> Grid.<span style="color: #0000FF;">Row</span>=<span style="color: #808080;">&quot;0&quot;</span> Grid.<span style="color: #0000FF;">Column</span>=<span style="color: #808080;">&quot;0&quot;</span>
    Opacity=<span style="color: #808080;">&quot;{Binding ElementName=canvas, Mode=TwoWay, Path=Opacity}&quot;</span>&gt;
	&lt;Image x:Name=<span style="color: #808080;">&quot;ReflectionTile_00&quot;</span>
              Source=<span style="color: #808080;">&quot;{Binding ElementName=ImageTile_00, Mode=TwoWay, Path=Source}&quot;</span>
              Opacity=<span style="color: #808080;">&quot;{Binding ElementName=ImageTile_00, Mode=TwoWay, Path=Opacity}&quot;</span>
              Width=<span style="color: #808080;">&quot;120&quot;</span> Height=<span style="color: #808080;">&quot;93&quot;</span> Margin=<span style="color: #808080;">&quot;5,5,0,0&quot;</span> Stretch=<span style="color: #808080;">&quot;Fill&quot;</span> Cursor=<span style="color: #808080;">&quot;Hand&quot;</span>&gt;
		&lt;Image.<span style="color: #0000FF;">Effect</span>&gt;
			&lt;DropShadowEffect Opacity=<span style="color: #808080;">&quot;0.6&quot;</span> ShadowDepth=<span style="color: #808080;">&quot;3&quot;</span>/&gt;
		&lt;/Image.<span style="color: #0000FF;">Effect</span>&gt;
	&lt;/Image&gt;
	&lt;Rectangle x:Name=<span style="color: #808080;">&quot;ReflectionStroke_00&quot;</span> Width=<span style="color: #808080;">&quot;120&quot;</span> Height=<span style="color: #808080;">&quot;93&quot;</span> Stroke=<span style="color: #808080;">&quot;#FFFFBA00&quot;</span>
               Opacity=<span style="color: #808080;">&quot;{Binding ElementName=StrokeHighlight_00, Mode=TwoWay, Path=Opacity}&quot;</span>
               Margin=<span style="color: #808080;">&quot;5,5,0,0&quot;</span> StrokeThickness=<span style="color: #808080;">&quot;2&quot;</span>/&gt;
&lt;/Canvas&gt;
&nbsp;</pre>
<p>Notice that I've bound multiple properties - for the Image, both Source and Opacity are bound. This means if I change a thumbnail image, the reflection image updates automatically. If I animate the Opacity property of the thumbnail image, the reflection image opacity also animates. The text caption on the right side panel was done the same way.</p>
<p><strong>ImageOpened Event</strong><br />
There are two sets of storyboards in the project. One that handles the slideshow functionality, and one that handles the selected image functionality. Both work in essentially the same manner. Fade the image being displayed, update the image to the next one to display, and then show the image. I handled the last step in an ImageOpened event handler to ensure that the target image was available before begining the "show" storyboard.</p>
<p>For the change that occurs when the main image fades out, that event listener looks like this:</p>
<pre class="csharp">&nbsp;
SelectedImage.<span style="color: #0000FF;">ImageOpened</span> += <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> EventHandler&lt;RoutedEventArgs&gt;<span style="color: #000000;">&#40;</span>SelectedImage_ImageOpened<span style="color: #000000;">&#41;</span>;
&nbsp;</pre>
<p>My event handler handles both the case of a new image being loaded for the slideshow, or a new image being loaded by user selection. I flip a flag called StopSlideshow when a thumbnail is selected, and then test against that to shift to the appropriate storyboard set. The handler looks like this:</p>
<pre class="csharp">&nbsp;
<span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> SelectedImage_ImageOpened<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, RoutedEventArgs e<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>!StopSlideshow<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        ShowMainImage.<span style="color: #0000FF;">Begin</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">else</span>
    <span style="color: #000000;">&#123;</span>
        ShowForSelected.<span style="color: #0000FF;">Begin</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>All of the images for the application are configured via an XML file called imagefile.xml, which is stored in the ClientBin folder. The format is fairly self-explanatory, but looks like this:</p>
<pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;image</span> <span style="color: #000066;">thumb</span>=<span style="color: #ff0000;">&quot;Images/adamsSunrise640x480_thumb.jpg&quot;</span>
<span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;Images/adamsSunrise640x480.jpg&quot;</span>
<span style="color: #000066;">caption</span>=<span style="color: #ff0000;">&quot;Sunrise over Mt. Adams (from Mt. St. Helens)&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></pre>
<p>There were two things I did not code into this version of the application, which I will likely go back and add later. The first is the "spotlight" effect seen in the original application, which was done with an opacity mask. The reason why I left that off is that it doesn't work right in the current rev of Silverlight 3. I get an unmasked edge along the left of the panel. I haven't decided yet if I like the cleaner, brighter look of the updated app more. </p>
<p>The second is a simple test to check and see if the selected image is the same as the one being displayed. If it is, no action should be taken, but as it stands, the app still accepts input, and cycles out of and then in to the same image, which is not an ideal experience, but it's getting late....</p>
<p>Now, as promised, the code for this project can be found <a href="http://designwithsilverlight.com/silverlight_3/galleryWall/GalleryWall.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://designwithsilverlight.com/2009/03/31/silverlight-3-photo-gallery-wall-application/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MIX&#8217;09 Presentation Projects</title>
		<link>http://designwithsilverlight.com/2009/03/29/mix09-presentation-projects/</link>
		<comments>http://designwithsilverlight.com/2009/03/29/mix09-presentation-projects/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 02:52:55 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[MIX09. animation]]></category>

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

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

		<guid isPermaLink="false">http://designwithsilverlight.com/?p=158</guid>
		<description><![CDATA[I've gotten some emails from people interested in the project assets for my MIX'09 presentation, so I have placed them online for download. The VR and sprite animation ones are fairly graphically heavy, so the archive size is about 47MB.
You can download it here.
]]></description>
			<content:encoded><![CDATA[<p>I've gotten some emails from people interested in the project assets for my MIX'09 presentation, so I have placed them online for download. The VR and sprite animation ones are fairly graphically heavy, so the archive size is about 47MB.</p>
<p>You can download it <a href="http://designwithsilverlight.com/SilverlightBookProjects/Paries_MIX09_Projects.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://designwithsilverlight.com/2009/03/29/mix09-presentation-projects/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using the new Silverlight 3 Perspective tools to emulate 3D</title>
		<link>http://designwithsilverlight.com/2009/03/22/using-the-new-silverlight-3-perspective-tools-to-emulate-3d/</link>
		<comments>http://designwithsilverlight.com/2009/03/22/using-the-new-silverlight-3-perspective-tools-to-emulate-3d/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 20:46:53 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
		
		<category><![CDATA[Tutorial]]></category>

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

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

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

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

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

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

		<category><![CDATA[Silverlight 3]]></category>

		<guid isPermaLink="false">http://designwithsilverlight.com/?p=151</guid>
		<description><![CDATA[To learn about the perspective tools available in Silverlight 3, a good place to start is my friend Corey Schuman's post.
I had a conversation with Jesse Liberty at MIX09 this past week, and we talked about different techniques for animating various objects. Out of that conversation, I wanted to explore how to go about emulating [...]]]></description>
			<content:encoded><![CDATA[<p>To learn about the perspective tools available in Silverlight 3, a good place to start is my friend Corey Schuman's <a title="Simple Perspective 3D in Silverlight 3" href="http://www.85turns.com/2009/03/18/simple-perspective-3d-in-silverlight-3-beta-1/" target="_blank">post</a>.</p>
<p>I had a conversation with <a title="Jesse Liberty's Blog" href="http://silverlight.net/blogs/jesseliberty/" target="_blank">Jesse Liberty</a> at MIX09 this past week, and we talked about different techniques for animating various objects. Out of that conversation, I wanted to explore how to go about emulating a 3D object with the new Perspective Tools in Blend/Silverlight 3.</p>
<p>I spent some time putting together an application that simulates a 3D playing card rotation. If you have Silverlight 3 installed, you can see that application <a title="Silverlight 3 Card Flip" href="http://designwithsilverlight.com/silverlight_3/cardflip/" target="_blank">here</a>. The project files are available at the end of this post.</p>
<p>The basic functionality for the project involves two images - a "card front" image, which in this case was the Jack of Clubs, and a "card back" image, which is a standard blue backed deck. The two images are aligned right on top of one another. The 3D perspective manipulations are enabled and bound to sliders as Corey describes in the article linked above. I added a bit of code in the code-behind file to "watch" for certain ranges and collapse the visibility of the "card back" image when the "card front" should be showing. There are two tricks involved with this.</p>
<p>First, the card face image is loaded and by default is scaled to -1X. This reverses the image. This is because the perspective tools actually flip around the image. If it was not scaled to -1X, the card front would actually show up backwards when it's rotated and made visible.</p>
<p>The second is the drop shadow bitmap effect I added. This one was a bit confusing - in Joe Stegman's session on the new features added to Silverlight 3, he made the point several times that bitmap effects were the last step before an object is written to the screen. If this were the case, the effects would not be affected by the perspective transforms, but they appear to be as the drop shadow flips along with the transform. At any rate, this was easy enough to solve. I grouped my card object into another canvas, and moved the effect off of the canvas containing the card images to the new container.</p>
<p>Let's take a look at some code. Following is the "CardEffectContainer" Canvas object, which is where the actual drop shadow effect is applied to the object. Inside of that is the "Jack_Clubs" Canvas object, which contains the Canvas.Projection used to make the card appear as though it is rotating. You can also see the "CardFront" and "CardBack" images. As I mentioned above, notice that the CardFront image is scaled -1X.</p>
<pre class="csharp">&nbsp;
&lt;Canvas x:Name=<span style="color: #808080;">&quot;CardEffectContainer&quot;</span> Height=<span style="color: #808080;">&quot;252&quot;</span> Width=<span style="color: #808080;">&quot;185&quot;</span> Canvas.<span style="color: #0000FF;">Left</span>=<span style="color: #808080;">&quot;300&quot;</span> Canvas.<span style="color: #0000FF;">Top</span>=<span style="color: #808080;">&quot;110&quot;</span>&gt;
	&lt;Canvas.<span style="color: #0000FF;">Effect</span>&gt;
		&lt;DropShadowEffect Opacity=<span style="color: #808080;">&quot;0.5&quot;</span> BlurRadius=<span style="color: #808080;">&quot;8&quot;</span>/&gt;
	&lt;/Canvas.<span style="color: #0000FF;">Effect</span>&gt;
	&lt;Canvas x:Name=<span style="color: #808080;">&quot;Jack_Clubs&quot;</span> Height=<span style="color: #808080;">&quot;252&quot;</span> Width=<span style="color: #808080;">&quot;185&quot;</span> IsHitTestVisible=<span style="color: #808080;">&quot;False&quot;</span>&gt;
		&lt;Canvas.<span style="color: #0000FF;">Projection</span>&gt;
			&lt;PlaneProjection x:Name=<span style="color: #808080;">&quot;CardRotation&quot;</span> RotationX=<span style="color: #808080;">&quot;0&quot;</span> RotationY=<span style="color: #808080;">&quot;0&quot;</span> RotationZ=<span style="color: #808080;">&quot;0&quot;</span>/&gt;
		&lt;/Canvas.<span style="color: #0000FF;">Projection</span>&gt;
		&lt;Image x:Name=<span style="color: #808080;">&quot;CardFront&quot;</span> Height=<span style="color: #808080;">&quot;252&quot;</span> Width=<span style="color: #808080;">&quot;185&quot;</span>
                             Source=<span style="color: #808080;">&quot;cardFront.png&quot;</span> RenderTransformOrigin=<span style="color: #808080;">&quot;0.5,0.5&quot;</span>&gt;
			&lt;Image.<span style="color: #0000FF;">RenderTransform</span>&gt;
				&lt;TransformGroup&gt;
					&lt;ScaleTransform ScaleX=<span style="color: #808080;">&quot;-1&quot;</span>/&gt;
					&lt;SkewTransform/&gt;
					&lt;RotateTransform/&gt;
					&lt;TranslateTransform/&gt;
				&lt;/TransformGroup&gt;
			&lt;/Image.<span style="color: #0000FF;">RenderTransform</span>&gt;
		&lt;/Image&gt;
		&lt;Image x:Name=<span style="color: #808080;">&quot;CardBack&quot;</span> Height=<span style="color: #808080;">&quot;252&quot;</span> Width=<span style="color: #808080;">&quot;185&quot;</span> Canvas.<span style="color: #0000FF;">Left</span>=<span style="color: #808080;">&quot;0&quot;</span> Source=<span style="color: #808080;">&quot;cardBack.png&quot;</span>/&gt;
	&lt;/Canvas&gt;
&lt;/Canvas&gt;
&nbsp;</pre>
<p>After that, I have 3 Canvas object, each containing a Slider and associated TextBlock for display. Following is the listing for the SliderY control. Notice that the Value is using Binding to tie the Slider Control's Value to RotationY property in the "CardRotation" Canvas' PlaneProjection shown in the above listing. This makes it so I don't need to write any code in order to allow the Slider to affect the rotation value.</p>
<pre class="csharp">&nbsp;
&lt;Canvas x:Name=<span style="color: #808080;">&quot;YRotationStuff&quot;</span> Height=<span style="color: #808080;">&quot;37&quot;</span> Width=<span style="color: #808080;">&quot;200&quot;</span> Canvas.<span style="color: #0000FF;">Left</span>=<span style="color: #808080;">&quot;20&quot;</span> Canvas.<span style="color: #0000FF;">Top</span>=<span style="color: #808080;">&quot;491&quot;</span>&gt;
	&lt;Slider x:Name=<span style="color: #808080;">&quot;SliderY&quot;</span> Width=<span style="color: #808080;">&quot;200&quot;</span>
              Value=<span style="color: #808080;">&quot;{Binding ElementName=CardRotation, Mode=TwoWay, Path=RotationY}&quot;</span>
              Minimum=<span style="color: #808080;">&quot;0&quot;</span> Maximum=<span style="color: #808080;">&quot;360&quot;</span> Canvas.<span style="color: #0000FF;">Top</span>=<span style="color: #808080;">&quot;19&quot;</span>/&gt;
	&lt;TextBlock x:Name=<span style="color: #808080;">&quot;SliderYValue&quot;</span> Text=<span style="color: #808080;">&quot;Y Rotation: 0.00&quot;</span> TextWrapping=<span style="color: #808080;">&quot;Wrap&quot;</span> Foreground=<span style="color: #808080;">&quot;#FFFFFFFF&quot;</span>/&gt;
&lt;/Canvas&gt;
&nbsp;</pre>
<p>I'm not going to show the X and Z rotation sliders here in this post, but they look just like the Y Slider code shown above. In my code behind, I needed to watch the rotations in order to hide the card back at the appropriate times. This was done by setting up two event listeners as shown below.</p>
<pre class="csharp">&nbsp;
SliderY.<span style="color: #0000FF;">ValueChanged</span> += <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> RoutedPropertyChangedEventHandler<span style="color: #000000;">&#40;</span>Slider_ValueChanged<span style="color: #000000;">&#41;</span>;
SliderX.<span style="color: #0000FF;">ValueChanged</span> += <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> RoutedPropertyChangedEventHandler<span style="color: #000000;">&#40;</span>Slider_ValueChanged<span style="color: #000000;">&#41;</span>;
&nbsp;</pre>
<p>Notice that both listeners call the same event handler - Slider_ValueChanged - which is shown following. This event handler starts out by updating the text visible to the user. I orignally had this property bound but wanted to do some formatting on the text, so pushed it to the code behind.</p>
<p>After that, you'll see a series of "if" statements that test ranges of values to determine the rotational state of the card. For example, the first statement checks to see if the card has been rotated along the X axis (tilting the card forward or backwards) more than 90 degrees, or less than 270 degrees.</p>
<p>That condition would result in the card front being visible (to visualize this, hold a playing card straight out in front of you and rotate it towards you - when you pass 90 degrees, you can see the card front, when you pass 270 degrees, you're viewing the card back again).</p>
<p>Since we're dealing with multiple axes here, we also need to check the Y rotation value. If the card has been rotated along the Y axis less than 90 degrees, or more than 270 degrees, then we know that the X and Y values are in a range where the card front should be visible, and we collapse the CardBack image from view. Easy, right? </p>
<p>You can see the other set of tests used to determine the card front visibility in the listing.</p>
<pre class="csharp">&nbsp;
<span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> Slider_ValueChanged<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, RoutedPropertyChangedEventArgs&lt;double&gt; e<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    SliderXValue.<span style="color: #0000FF;">Text</span> = <span style="color: #808080;">&quot;X Rotation: &quot;</span> + <span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;{0:0.00}&quot;</span>, SliderX.<span style="color: #0000FF;">Value</span><span style="color: #000000;">&#41;</span>;
    SliderYValue.<span style="color: #0000FF;">Text</span> = <span style="color: #808080;">&quot;Y Rotation: &quot;</span> + <span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;{0:0.00}&quot;</span>, SliderY.<span style="color: #0000FF;">Value</span><span style="color: #000000;">&#41;</span>;
&nbsp;
    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>SliderX.<span style="color: #0000FF;">Value</span> &gt; <span style="color: #FF0000;">90</span> &amp;&amp; SliderX.<span style="color: #0000FF;">Value</span> &lt; <span style="color: #FF0000;">270</span> &amp;&amp; <span style="color: #000000;">&#40;</span>SliderY.<span style="color: #0000FF;">Value</span> &lt; <span style="color: #FF0000;">90</span> || SliderY.<span style="color: #0000FF;">Value</span> &gt; <span style="color: #FF0000;">270</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        CardBack.<span style="color: #0000FF;">Visibility</span> = Visibility.<span style="color: #0000FF;">Collapsed</span>;
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">else</span> <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>SliderX.<span style="color: #0000FF;">Value</span> &gt; <span style="color: #FF0000;">90</span> &amp;&amp; SliderX.<span style="color: #0000FF;">Value</span> &lt; <span style="color: #FF0000;">270</span> &amp;&amp; <span style="color: #000000;">&#40;</span>SliderY.<span style="color: #0000FF;">Value</span> &gt; <span style="color: #FF0000;">90</span> &amp;&amp; SliderY.<span style="color: #0000FF;">Value</span> &lt; <span style="color: #FF0000;">270</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        CardBack.<span style="color: #0000FF;">Visibility</span> = Visibility.<span style="color: #0000FF;">Visible</span>;
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">else</span> <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>SliderX.<span style="color: #0000FF;">Value</span> &lt; <span style="color: #FF0000;">90</span> || SliderX.<span style="color: #0000FF;">Value</span> &gt; <span style="color: #FF0000;">270</span><span style="color: #000000;">&#41;</span> &amp;&amp; <span style="color: #000000;">&#40;</span>SliderY.<span style="color: #0000FF;">Value</span> &lt; <span style="color: #FF0000;">90</span> || SliderY.<span style="color: #0000FF;">Value</span> &gt; <span style="color: #FF0000;">270</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        CardBack.<span style="color: #0000FF;">Visibility</span> = Visibility.<span style="color: #0000FF;">Visible</span>;
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">else</span> <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>SliderX.<span style="color: #0000FF;">Value</span> &lt; <span style="color: #FF0000;">90</span> || SliderX.<span style="color: #0000FF;">Value</span> &gt; <span style="color: #FF0000;">270</span><span style="color: #000000;">&#41;</span> &amp;&amp; <span style="color: #000000;">&#40;</span>SliderY.<span style="color: #0000FF;">Value</span> &gt; <span style="color: #FF0000;">90</span> || SliderY.<span style="color: #0000FF;">Value</span> &lt; <span style="color: #FF0000;">270</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        CardBack.<span style="color: #0000FF;">Visibility</span> = Visibility.<span style="color: #0000FF;">Collapsed</span>;
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>That handles X and Y rotations, but what about Z? The Z-axis runs directly into your screen and would spin the card like a propeller (assuming the transform origin were in the center as it is here). Since the visibility of the card front is handled when the X and Y sliders are manipulated, all we need to do is update the feedback we're giving the user when the Z-slider is manipulated (remember that the value is bound through the XAML, so no code is necessary to update the actual Z rotation).</p>
<p>This is done with a simple event listener:</p>
<pre class="csharp">&nbsp;
SliderZ.<span style="color: #0000FF;">ValueChanged</span> += <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> RoutedPropertyChangedEventHandler<span style="color: #000000;">&#40;</span>SliderZ_ValueChanged<span style="color: #000000;">&#41;</span>;
&nbsp;</pre>
<p>and its associated handler, shown here:</p>
<pre class="csharp">&nbsp;
<span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> SliderZ_ValueChanged<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, RoutedPropertyChangedEventArgs e<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    SliderZValue.<span style="color: #0000FF;">Text</span> = <span style="color: #808080;">&quot;Z Rotation: &quot;</span> + <span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;{0:0.00}&quot;</span>, SliderZ.<span style="color: #0000FF;">Value</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>From that, you get a fairly convincing 3D object rotation that was created from just a couple of images. Of course, a playing card is flat, so it's easy to manipulate in this manner. If you have all of the Silverlight 3 bits installed and would like the grab the project file, it's <a title="CardFlip Project File" href="http://designwithsilverlight.com/silverlight_3/cardflip/CardFlip.zip" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://designwithsilverlight.com/2009/03/22/using-the-new-silverlight-3-perspective-tools-to-emulate-3d/feed/</wfw:commentRss>
		</item>
		<item>
		<title>TechFest DeepZoom</title>
		<link>http://designwithsilverlight.com/2009/03/02/techfest-deepzoom/</link>
		<comments>http://designwithsilverlight.com/2009/03/02/techfest-deepzoom/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 22:18:30 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
		
		<category><![CDATA[Tutorial]]></category>

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

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

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

		<guid isPermaLink="false">http://designwithsilverlight.com/?p=149</guid>
		<description><![CDATA[If you get a chance, check out the DeepZoom application that was done for TechFest. You can find it here.
The DeepZoom app contains a collection of posters that were put together by various researchers to describe their projects. There's some pretty interesting stuff in there. One of the ones I find especially interesting is Headlight, which [...]]]></description>
			<content:encoded><![CDATA[<p>If you get a chance, check out the DeepZoom application that was done for TechFest. You can find it <a title="TechFest R&amp;D Posters" href="http://www.microsoft.com/presspass/events/msrtechfest/posterGallery.aspx" target="_blank">here</a>.</p>
<p>The DeepZoom app contains a collection of posters that were put together by various researchers to describe their projects. There's some pretty interesting stuff in there. One of the ones I find especially interesting is Headlight, which is the 3rd poster down in the right hand column.</p>
<p>I was fortunate enough to be able to take Headlight for a spin, and it's a pretty slick add-on to Composer. The projects are very similar to Composer - you import images and lay them out, but you also have the chance to add tooltips, menus, and links to the items in the collection before doing the export. There is even an option to enable some metrics for items in the collection. The team working on the Headlight project doesn't have a public-facing site just yet, but keep this one on your radar - it might change the way you view ads.</p>
]]></content:encoded>
			<wfw:commentRss>http://designwithsilverlight.com/2009/03/02/techfest-deepzoom/feed/</wfw:commentRss>
		</item>
		<item>
		<title>More on optimizing XAP files</title>
		<link>http://designwithsilverlight.com/2009/02/19/more-on-optimizing-xap-files/</link>
		<comments>http://designwithsilverlight.com/2009/02/19/more-on-optimizing-xap-files/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 16:35:33 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
		
		<category><![CDATA[Main]]></category>

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

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

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

		<guid isPermaLink="false">http://designwithsilverlight.com/?p=147</guid>
		<description><![CDATA[I got a couple of comments on my post about shrinking XAP sizes here. I haven't been able to follow up as quickly as I would have liked due to a couple of large projects I'm working on in addition to preparing for MIX'09. 
The crux of the comments were to use a tool like ComponentOne [...]]]></description>
			<content:encoded><![CDATA[<p>I got a couple of comments on my post about shrinking XAP sizes <a title="Shrinking XAP Size" href="http://designwithsilverlight.com/2009/01/04/shrinking-xap-size/" target="_blank">here</a>. I haven't been able to follow up as quickly as I would have liked due to a couple of large projects I'm working on in addition to preparing for MIX'09. </p>
<p>The crux of the comments were to use a tool like ComponentOne XapOptimizer, which can be found here: <a href="http://labs.componentone.com/XapOptimizer/" target="_blank">http://labs.componentone.com/XapOptimizer/</a></p>
<p>I tested it on a couple of projects, and it seems to give me about the equivalent reduction in archive size as unzipping and rezipping the XAP package. It appears to be another great tool to add to your arsenal, although you may be able to squeeze out some additional space by optimizing the graphics in your application prior to utilizing XapOptimizer. Definitely worth checking out.</p>
]]></content:encoded>
			<wfw:commentRss>http://designwithsilverlight.com/2009/02/19/more-on-optimizing-xap-files/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
