<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Designer Silverlight &#187; without a line of code</title>
	<atom:link href="http://www.designersilverlight.com/category/without-a-line-of-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.designersilverlight.com</link>
	<description>Matthias Shapiro's Silverlight &#38; WPF Blog - Because Developers Get All The Good Blogs</description>
	<lastBuildDate>Thu, 26 Jan 2012 06:45:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>App Bars in Windows Phone 7 In Blend</title>
		<link>http://www.designersilverlight.com/2011/01/17/app-bars-in-windows-phone-7-in-blend/</link>
		<comments>http://www.designersilverlight.com/2011/01/17/app-bars-in-windows-phone-7-in-blend/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 06:55:40 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[without a line of code]]></category>
		<category><![CDATA[app bar]]></category>
		<category><![CDATA[applicationBar]]></category>
		<category><![CDATA[applicationBarIconButton]]></category>
		<category><![CDATA[ApplicationBarMenuItem]]></category>
		<category><![CDATA[theming]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/2011/01/17/app-bars-in-windows-phone-7-in-blend/</guid>
		<description><![CDATA[App bars in Windows Phone 7 are actually a pretty cool little bit of functionality. They give the user 1-4 instantly accessible options for dealing with the screen the user is on, their buttons auto-animate in, they offer “always on” funtionality that isn’t going to be hidden by the on-screen keyboard, they give designers and [...]]]></description>
			<content:encoded><![CDATA[<p>App bars in Windows Phone 7 are actually a pretty cool little bit of functionality. They give the user 1-4 instantly accessible options for dealing with the screen the user is on, their buttons auto-animate in, they offer “always on” funtionality that isn’t going to be hidden by the on-screen keyboard, they give designers and developers instant access to a range of default icons in Windows Phone 7 ecosystem and they offer a much wider range of options when the user taps on the ellipses to open more options.</p>
<p>That’s a lot for such a little thing item. So you may be asking yourself, “What the hell is he talking about? What is an ‘App Bar’?” This:</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image13.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 5px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb13.png" width="342" height="69" /></a></p>
<p>And like this when the ellipses are tapped</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image14.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb14.png" width="335" height="233" /></a></p>
<p>But what gets me is the fact that making these things is so damn easy, thanks to the fact that Blend is the single greatest product ever created for people who want to design user interfaces. And you can quote me on that. My crush on the Microsoft Blend team is well documented.</p>
<p>Anyway. </p>
<p>So let’s go about mak</p>
<h2>Making the App Bar</h2>
<p>ing this app bar. You may be surprised to know that we can do pretty much everything we need to do without a single line of code. Because Blend is so stinking awesome.</p>
<p>First, select the PhoneApplicationPage in your Object and Timeline tab in Blend.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image15.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb15.png" width="228" height="137" /></a></p>
<p>In the “Common Properties” section, you’ll see an “ApplicationBar” property. Click on the “New” button. You should see the following:</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image16.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 5px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb16.png" width="313" height="249" /></a></p>
<h2>Add App Bar Buttons</h2>
<p>Click on the “…” button to the right of “Buttons (Collection)”. Up will pop a “Collection Editor: Buttons” pop-up. Click on the “Add another item” button. </p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image17.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb17.png" width="307" height="57" /></a></p>
<p>Type “Button” and you should see a “ApplicationBarIconButton” option.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image18.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb18.png" width="378" height="128" /></a></p>
<p>Double-click on it. It will add an App bar button to your app bar. You should have a set of “Common Properties” that you can set. Type in the text you want (in our case, “done”) and click on the IconUri box. You will see a list of default Windows Phone 7 icons. Pick the one that works for you (I picked the check mark). </p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image19.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb19.png" width="307" height="191" /></a></p>
<p>Do that same thing over again, but pick the close icon and give it the text “close”. Hit “OK” to close the app bar pop-up. Believe it or not, we’re done. Yeah, we need to hook up some Click events so they can actually do something, but the rest of it is all taken care of.</p>
<p>If you need to get back to the App Bar design, you can just click on the ApplicationBar in the “Objects and Timeline” and see the options again.</p>
<h2>Add App Bar Menu Items</h2>
<p>Adding menu items is similarly easy. Under the “Buttons (Collection)” item we clicked on earlier, there is a “MenuItems (Colleciton)” button. Click on it. </p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image20.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb20.png" width="308" height="105" /></a></p>
<p>We see the same “Collection Editor and we’ll click “Add another item” again. This time, though, we type “menu” and double click on ApplicationBarMenuItem.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image21.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 5px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb21.png" width="375" height="116" /></a></p>
<p>Add the text (“do one thing”) and run the process again to add another item. Click “OK” when you’re done. </p>
<h2>Colors &amp; the Application Bar</h2>
<p>Designing the App Bar is pretty easy. The icons that we assigned to the buttons actually just act as opacity masks (I assume that’s how it works… it seems to make sense) so that they will change to whatever color is assigned to the foreground of the app bar. Warning: they will default to the theme foreground unless you explicitly set them to be another color. If you’ve decided not to work with the default theming engine, you will need to explicitly set the foreground and the background of the App Bar. </p>
<p>I talk about this a little bit more in <a href="http://www.designersilverlight.com/2011/01/17/theme-forcing-for-windows-phone-7-silverlight/">my post on Windows Phone 7 theming</a>. That might be a good place to go if you’re working on fine-tuning the app bar to fit into a non-themed design. </p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.designersilverlight.com/2011/01/17/app-bars-in-windows-phone-7-in-blend/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=App+Bars+in+Windows+Phone+7+In+Blend+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1252" title="Post to Twitter"><img class="nothumb" src="http://www.designersilverlight.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=App+Bars+in+Windows+Phone+7+In+Blend+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1252" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2011/01/17/app-bars-in-windows-phone-7-in-blend/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Silverlight to Display JSON Data (Collected From The New York Times API)</title>
		<link>http://www.designersilverlight.com/2009/02/25/using-silverlight-to-display-json-data-collected-from-the-new-york-times-api/</link>
		<comments>http://www.designersilverlight.com/2009/02/25/using-silverlight-to-display-json-data-collected-from-the-new-york-times-api/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 07:36:00 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Binding]]></category>
		<category><![CDATA[Blend]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[without a line of code]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/2009/02/25/using-silverlight-to-display-json-data-collected-from-the-new-york-times-api/</guid>
		<description><![CDATA[In this post, you’ll either need to walk through this tutorial on how to call and prepare JSON data gathered from the New York Times API or, if you’re not particularly interested in doing that, you can just download the final project here. This tutorial pretty much assumes that you’re starting from the end of [...]]]></description>
			<content:encoded><![CDATA[<p>In this post, you’ll either need to walk through this tutorial on <a href="http://www.designersilverlight.com/2009/02/25/adventures-with-json-and-silverlight-and-the-new-york-times/">how to call and prepare JSON data gathered from the New York Times API</a> or, if you’re not particularly interested in doing that, <a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/jsonnewyorktimestutorial_part_1.zip">you can just download the final project here</a>. This tutorial pretty much assumes that you’re starting from the end of that tutorial.</p>
<p>Fortunately for everyone involved (especially me), this tutorial is much shorter. It is also another in my “without a line of code” series in which you can do everything without even touching the code. Let’s open up our project in Blend and get started. (To see an example what this tutorial makes, scroll to the bottom of this post.)</p>
<p>First of all, I lied. You do have to touch one line of code because <a href="http://developer.nytimes.com/apps/register">you need to get your NYT API key</a> and plug it into the myApiKey variable in the Page constructor (line 26 in the project available for download). The line should look like this:</p>
<p>myApiKey = <span style="color: #a31515">&#8220;&amp;api-key=your_api_key_here&#8221;</span>;</p>
<p>Now, right click on the project solution and select “Build Solution” (in Visual Studio or Blend, it doesn’t matter).</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image0011.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image001-thumb1.png" border="0" alt="clip_image001" width="349" height="149" /></a></p>
<p>This should build the assemblies so that Blend can do a really neat trick. In the Project tab in Blend, you should see a Data panel in the bottom half. Click on the &#8220;+ CLR Object” button.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00151.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[5]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image0015-thumb1.png" border="0" alt="clip_image001[5]" width="298" height="60" /></a></p>
<p>A pop-up will gently encourage you to name your new data source and choose from a list of available data sources. Select “NYTResult” and hit OK.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00171.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[7]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image0017-thumb1.png" border="0" alt="clip_image001[7]" width="398" height="228" /></a></p>
<p>You will now have your NYTResult data source show up in your Data pane. Before we start building a nice slick looking interface, select your ListBox (named “ResultsDisplay”) and, in the Properties pane, find the “Display Member Path” and reset it by clicking on the little gray box to the right.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image001131.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[13]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00113-thumb1.png" border="0" alt="clip_image001[13]" width="298" height="170" /></a></p>
<p>Now, right-click on the ListBox  in your “Objects and Timeline” panel and select “Bind ItemsSource to Data…”</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00191.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[9]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image0019-thumb1.png" border="0" alt="clip_image001[9]" width="269" height="263" /></a></p>
<p>Select the data source you just created and select “NYTResult”. Then click on “Define DataTemplate” at the bottom. This will take you to the “Create Data Template” panel, where the fun happens. You will see “New Data Template and Display Fields” automatically selected. We like this. This lets us select all the data we want and give it some basic structure and Blend will do all the bindings for us.</p>
<p>Let’s make a few changes from the standard Data Template setup. Expand the Date field and check Day, DayOfWeek, Month, and Year and change the order with the up and down buttons to something you like. Then, change the Url from “StackPanel” to “TextBlock”. I reordered the data a little bit, so my template looks like this:</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image001151.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[15]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00115-thumb1.png" border="0" alt="clip_image001[15]" width="332" height="321" /></a></p>
<p>Hit OK. The point of that whole exercise was so that Blend would build our data template for us. We don’t actually want the data source and we don’t want our ListBox bound to it. So reset the “ItemSource” property on the ListBox and remove the NYTResult data source. If you run the project now, you should get something like this:</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00117.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[17]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00117-thumb.png" border="0" alt="clip_image001[17]" width="411" height="309" /></a></p>
<p>At least we’re getting more data now. Doesn’t look that great, but we’re getting there. Go back to your project in Blend and right-click on your ListBox and go to “Edit Other Templates –&gt; Edit Generated Items (ItemTemplate) –&gt; Edit Template”</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00119.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[19]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00119-thumb.png" border="0" alt="clip_image001[19]" width="555" height="344" /></a></p>
<p>We’re now in the DataTemplate but we sadly have no visible data, which makes manipulating it a tad difficult. What I have found works best for me is just to build my desired layout with static data and then translate the bindings. (I haven’t mentioned this, but <a href="http://www.designersilverlight.com/2009/02/04/6-tips-for-designers-for-translating-your-comps-into-xaml/">you should be working in Split mode as a general rule</a>, so you should be able to see the bindings in the XAML.)</p>
<p>So… long story short (it’s getting really late here): I changed the layout to replicate the NYT story design… the Title is a hyperlink button that takes us to the full story, followed by a small byline, the beginning of the story and the date on which the story appeared. If you’d like to look at the design itself in more detail, download the project at the end of this post.</p>
<p>I do want to mention one issue… the issue of getting your text to wrap. With my current redesigned DataTemplate, my project looks like this:</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00121.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[21]" src="http://www.designersilverlight.com/wp-content/uploads/2009/02/clip-image00121-thumb.png" border="0" alt="clip_image001[21]" width="411" height="311" /></a></p>
<p>It scrolls horizontally to a degree that is certainly unhealthy. What is happening is that the TextBlock in the DataTemplate is making a request for space and when it hits a limit, it will start wrapping. Unfortunately for us, when the ScrollViewer in the ListBox has the HorizontalScrollBarVisibility set to “Auto”, it is telling the TextBlock that it has all the room in the world and that it doesn’t need to wrap. So, let’s just change the HorizontalScrollBarVisibility on the ListBox to “Disabled”.</p>
<p>And we’re done.</p>
<p><iframe src="http://silverlight.services.live.com/invoke/77530/JSON_NYT_Tutorial_Part_2/iframe.html" scrolling="no" frameborder="0" style="width:400px; height:500px"></iframe></p>
<p>You can download the source here</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/02/jsonnewyorktimestutorial_part_2.zip">JSON &#8211; Silverlight &#8211; New York Times Tutorial (Part 2) Project Files</a></p>
<p>Questions and comments are always welcome.</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.designersilverlight.com/2009/02/25/using-silverlight-to-display-json-data-collected-from-the-new-york-times-api/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Using+Silverlight+to+Display+JSON+Data+%28Collected+From+The+New+York+Times+API%29+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D579" title="Post to Twitter"><img class="nothumb" src="http://www.designersilverlight.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Using+Silverlight+to+Display+JSON+Data+%28Collected+From+The+New+York+Times+API%29+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D579" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2009/02/25/using-silverlight-to-display-json-data-collected-from-the-new-york-times-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mask Animations (Clipping Path Animations) In Silverlight Without a Line of Code</title>
		<link>http://www.designersilverlight.com/2009/01/15/mask-animations-clipping-path-animations-in-silverlight-without-a-line-of-code/</link>
		<comments>http://www.designersilverlight.com/2009/01/15/mask-animations-clipping-path-animations-in-silverlight-without-a-line-of-code/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 17:14:46 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[without a line of code]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=472</guid>
		<description><![CDATA[Last night I submitted my MIX 10K Challenge piece, so I’m just killing time while I wait for it to get accepted. Please keep me in mind if you plan on voting. OK… I’ve been excited about this for some time now. I found out (almost completely by accident) that you can animate a mask [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I submitted my MIX 10K Challenge piece, so I’m just killing time while I wait for it to get accepted. Please keep me in mind if you plan on voting.</p>
<p>OK… I’ve been excited about this for some time now. I found out (almost completely by accident) that you can animate a mask (also known as a clipping path) in Silverlight without writing code or even typing (much). This is exciting because I think it’s something that might interest our Flash friends who, late at night and in the privacy of their own homes, take a peek to see if Silverlight is worth looking into. When I worked with Flash, mask animations were my bread and butter and they seemed so hard to do in Silverlight.</p>
<p>But they’re not.</p>
<p>First open up your project in Blend. (I always create my project in Visual Studio and then open it in Blend because visual Studio has so much better project debugging and makes testing a breeze.)</p>
<p>Find the item you want to clip (in my case this is an image) and select the pen tool from the toolbar.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/01/clip-image001.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001" src="http://www.designersilverlight.com/wp-content/uploads/2009/01/clip-image001-thumb.png" border="0" alt="clip_image001" width="44" height="46" /></a></p>
<p>And start drawing.I’m a poor artist, so the star I drew looks pretty bad. If you need to change any of the points, use the direct selection tool (the light arrow, second from the top).</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/01/clip-image0014.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[4]" src="http://www.designersilverlight.com/wp-content/uploads/2009/01/clip-image0014-thumb.png" border="0" alt="clip_image001[4]" width="42" height="114" /></a></p>
<p>OK… now the fun part. Add a storyboard to your project</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/01/clip-image0016.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[6]" src="http://www.designersilverlight.com/wp-content/uploads/2009/01/clip-image0016-thumb.png" border="0" alt="clip_image001[6]" width="332" height="141" /></a></p>
<p>and you can animate the clipping mask using all the normal animation tools. Use the direct selection tool above to animate the vertices. You’ll get something like this:</p>
<p><iframe src="http://silverlight.services.live.com/invoke/77530/pathAnimation_Part1/iframe.html" scrolling="no" frameborder="0" style="width:400px; height:300px"></iframe></p>
<p>Now… if you’re not interested in the details, just skip ahead a little bit. Something important happened the moment we started animating the path. Normally, path data is kept in a single string format that looks something like this:</p>
<p><span style="color: red;">Data</span><span style="color: blue;">=&#8221;M159.67175,104.26108 L177.91812,28.328932 L195.51648,104.43327 L255.0802,102.6104 L206.86984,151.82758 L225.8029,226.56477 L179.0616,179.17046 L129.73396,229.29906 L147.97842,150.63879 L98.650803,101.53297 z&#8221;</span></p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>This is actually a “<a href="http://msdn.microsoft.com/en-us/library/cc189041(VS.95).aspx">powerful and complex mini-language</a> that that you can use to describe geometric paths in XAML.” Microsoft uses it by default to handle path data. But it doesn’t work very well for animating paths, so the second you animate a single vertex in your path, it changes the format you see above to the format you see below:</p>
<p><span style="color: blue;">&lt;</span><span style="color: #a31515;">Path.Data</span><span style="color: blue;">&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: #a31515;">PathGeometry</span><span style="color: blue;">&gt;<br />
&lt;</span><span style="color: #a31515;">PathFigure </span><span style="color: red;">IsClosed</span><span style="color: blue;">=&#8221;True&#8221; </span><span style="color: red;">StartPoint</span><span style="color: blue;">=&#8221;91.0527648925781,84.0121078491211&#8243;&gt;<br />
&lt;</span><span style="color: #a31515;">LineSegment </span><span style="color: red;">Point</span><span style="color: blue;">=&#8221;118.057907104492,0.549586236476898&#8243;/&gt;<br />
&lt;</span><span style="color: #a31515;">LineSegment </span><span style="color: red;">Point</span><span style="color: blue;">=&#8221;144.103973388672,84.2013778686523&#8243;/&gt;<br />
&lt;</span><span style="color: #a31515;">LineSegment </span><span style="color: red;">Point</span><span style="color: blue;">=&#8221;232.259979248047,82.1977386474609&#8243;/&gt;<br />
&lt;</span><span style="color: #a31515;">LineSegment </span><span style="color: red;">Point</span><span style="color: blue;">=&#8221;160.907287597656,136.2958984375&#8243;/&gt;<br />
&lt;</span><span style="color: #a31515;">LineSegment </span><span style="color: red;">Point</span><span style="color: blue;">=&#8221;188.928756713867,218.444961547852&#8243;/&gt;<br />
&lt;</span><span style="color: #a31515;">LineSegment </span><span style="color: red;">Point</span><span style="color: blue;">=&#8221;119.750289916992,166.350433349609&#8243;/&gt;<br />
&lt;</span><span style="color: #a31515;">LineSegment </span><span style="color: red;">Point</span><span style="color: blue;">=&#8221;46.7439804077148,221.450408935547&#8243;/&gt;<br />
&lt;</span><span style="color: #a31515;">LineSegment </span><span style="color: red;">Point</span><span style="color: blue;">=&#8221;73.7462997436523,134.989212036133&#8243;/&gt;<br />
&lt;</span><span style="color: #a31515;">LineSegment </span><span style="color: red;">Point</span><span style="color: blue;">=&#8221;0.740016639232636,81.0134506225586&#8243;/&gt;<br />
&lt;/</span><span style="color: #a31515;">PathFigure</span><span style="color: blue;">&gt;<br />
&lt;/</span><span style="color: #a31515;">PathGeometry</span><span style="color: blue;">&gt;<br />
&lt;/</span><span style="color: #a31515;">Path.Data</span><span style="color: blue;">&gt;</span></p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Same data, but only this latter format is appropriate for animation. Remember this, it will come in handy in a second.</p>
<p>OK… now right click on your path and go to “Path –&gt; Make Clipping Path”</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/01/clip-image00110.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[10]" src="http://www.designersilverlight.com/wp-content/uploads/2009/01/clip-image00110-thumb.png" border="0" alt="clip_image001[10]" width="367" height="52" /></a></p>
<p>You’ll get a dialog pop-up that will ask you which item in the visual tree you would like to clip. I chose my image, but it will work with anything.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/01/clip-image00112.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="clip_image001[12]" src="http://www.designersilverlight.com/wp-content/uploads/2009/01/clip-image00112-thumb.png" border="0" alt="clip_image001[12]" width="297" height="158" /></a></p>
<p>And… poof! You have clipping animation.</p>
<p><iframe src="http://silverlight.services.live.com/invoke/77530/PathAnimation_Part2/iframe.html" scrolling="no" frameborder="0" style="width:400px; height:300px"></iframe></p>
<p>LIMITATIONS: Here are the limitations to this method:</p>
<ol>
<li><strong>You need to animate before you make your path into a clipping path. – </strong>Remember that little bit above about the data string format vs. path geometry? If you don’t animate before hand, Blend will convert all your beautiful line segments into the un-animate-able data string. Animating the path tells Blend to leave your formatting alone.</li>
<li><strong>Once you make your path a clipping  path, animation gets <em>a lot</em> harder</strong> – Basically, you can change the time by dragging the key frames around and change the easing. Any other alterations require entering values by hand. So do all your animation first before setting the path. The easiest work around to this is to copy and paste your path out of the Control.Clip section and back into your main XAML and tweak animation from there. But your best option is to just take the time to make your clipping animation perfect before you make it a clipping path.</li>
</ol>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.designersilverlight.com/2009/01/15/mask-animations-clipping-path-animations-in-silverlight-without-a-line-of-code/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Mask+Animations+%28Clipping+Path+Animations%29+In+Silverlight+Without+a+Line+of+Code+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D472" title="Post to Twitter"><img class="nothumb" src="http://www.designersilverlight.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Mask+Animations+%28Clipping+Path+Animations%29+In+Silverlight+Without+a+Line+of+Code+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D472" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2009/01/15/mask-animations-clipping-path-animations-in-silverlight-without-a-line-of-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

