<?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>Aimee Gurl... &#187; expression blend</title>
	<atom:link href="http://aimeegurl.com/tag/expression-blend/feed/" rel="self" type="application/rss+xml" />
	<link>http://aimeegurl.com</link>
	<description>for as long as i can remember, technology has always fascinated me</description>
	<lastBuildDate>Thu, 13 Oct 2011 12:07:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Will it Blend: Wrapping the Text on Silverlight Chart Legends</title>
		<link>http://aimeegurl.com/2010/11/30/will-it-blend-wrapping-the-text-on-silverlight-chart-legends/</link>
		<comments>http://aimeegurl.com/2010/11/30/will-it-blend-wrapping-the-text-on-silverlight-chart-legends/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 11:30:00 +0000</pubDate>
		<dc:creator>Aimee</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[expression blend]]></category>
		<category><![CDATA[no code]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[will it blend]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://aimeegurl.com/2010/11/30/will-it-blend-wrapping-the-text-on-silverlight-chart-legends/</guid>
		<description><![CDATA[In the course of my building our ROI app, I was trying to figure out how to wrap the legends of charts when the text gets too long. This is what I get with the default chart. You’ll see here, there’s a lot of waste of space for the legend when what I really want [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />
<p>In the course of my building our ROI app, I was trying to figure out how to wrap the legends of charts when the text gets too long. </p>
<p>This is what I get with the default chart.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/image1.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; 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://aimeegurl.com/wp-content/uploads/2010/11/image_thumb1.png" width="640" height="418" /></a></p>
<p>You’ll see here, there’s a lot of waste of space for the legend when what I really want to see is more of the chart.&#160; So first thing we’ll do is fix the width of the chart. To do that, <strong>Right Click on the chart,</strong> <strong>Edit Template</strong> then depending on whether you’ve already been fiddling with your chart template, either <strong>Edit Current or Edit a Copy </strong></p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-13h39_21.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 13h39_21" border="0" alt="2010-11-30 13h39_21" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-13h39_21_thumb.png" width="548" height="480" /></a></p>
<p>When you expand the template, you’ll see a grid within the grid that contains both the chart and the legend.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-13h42_32.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 13h42_32" border="0" alt="2010-11-30 13h42_32" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-13h42_32_thumb.png" width="640" height="441" /></a></p>
<p>You’ll notice that the grid is split into two, a star sized column and an auto sized one. Since autosizing will adapt the column size to the content, we’ll need to change this to star sized as well. You can do that by clicking on the icon and change it to the unlocked lock symbol. </p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h11_07.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h11_07" border="0" alt="2010-11-30 14h11_07" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h11_07_thumb.png" width="554" height="105" /></a></p>
<p>Now, you should be able to click on the triangle and resize the columns to your desired width ratios.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h12_46.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h12_46" border="0" alt="2010-11-30 14h12_46" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h12_46_thumb.png" width="554" height="82" /></a></p>
<p>You’ll notice that when you do this, your legend area won’t have as much space as before and since the legend items aren’t formatted to wrap by default, the text gets cropped if you have long lines of text.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h14_00.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h14_00" border="0" alt="2010-11-30 14h14_00" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h14_00_thumb.png" width="494" height="480" /></a></p>
<p>Return to the scope of the user control by clicking on this icon in your <strong>Objects and Timeline </strong>panel</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h17_00.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h17_00" border="0" alt="2010-11-30 14h17_00" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h17_00_thumb.png" width="217" height="108" /></a></p>
<p>Find one of your <strong>ColumnSeries </strong>(or whatever data series your chart is using) Right-click-&gt;<strong>Edit Additional Templates –</strong>&gt; <strong>Edit LegendItemStyle</strong> –&gt;<strong> Edit a Copy</strong></p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h19_22.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h19_22" border="0" alt="2010-11-30 14h19_22" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h19_22_thumb.png" width="448" height="223" /></a></p>
<p>Give your style a name, and choose where to define this style. This depends on where you will be using this style, if it’s only in this page, then you can choose document. If there are other pages, you think you’ll be using this style in, choose Application. If you want to be able to reuse this style in other applications ,choose Resource Dictionary, choose an existing one or create a new one if you don’t have one yet. This stores the style in a separate file which you can then later on import to your other projects.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h23_18.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h23_18" border="0" alt="2010-11-30 14h23_18" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h23_18_thumb.png" width="458" height="248" /></a></p>
<p>Clicking on OK should then bring your designer to to the LegendItem template designer. If you expand the StackPanel, you’ll see that we have the Rectangle and Title elements. If you look into the xaml code, you’ll see that the Title element is template-bound to a property called <strong>Content</strong>.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h31_26.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h31_26" border="0" alt="2010-11-30 14h31_26" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h31_26_thumb.png" width="640" height="264" /></a></p>
<p>In my case, since I know that the legend will only represent text content, I can simple delete the title element, replace it with a Textblock object and apply the same bindings. I can do that by first selecting the textbox, search for the text property in the search box of the <strong>Properties </strong>panel, then clicking on the small square beside the property to access advanced options.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h35_30.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h35_30" border="0" alt="2010-11-30 14h35_30" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h35_30_thumb.png" width="640" height="336" /></a></p>
<p>We select <strong>Template Binding –&gt; Content</strong></p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h38_51.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h38_51" border="0" alt="2010-11-30 14h38_51" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h38_51_thumb.png" width="477" height="480" /></a></p>
<p>One last thing to do is set the width of the TextBox since it’s currently auto sized and we can’t currently set the width to take up the rest of the unoccupied horizontal stackpanel space. <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://aimeegurl.com/wp-content/uploads/2010/11/wlEmoticon-smile.png" /> If you want your legend to scale dynamically, you’ll need to change the stackpanel into a grid. To do this, right-click on the StackPanel in your <strong>Objects and Timeline</strong> panel –&gt; <strong>Change Layout Type –&gt; </strong>and select <strong>Grid</strong></p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h46_38.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h46_38" border="0" alt="2010-11-30 14h46_38" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h46_38_thumb.png" width="493" height="261" /></a></p>
<p>After this step, check on your Rectangle, most likely, the <strong>Width </strong>and <strong>Height </strong>properties will be reset to auto so you’ll want to give this a size.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h01_40.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 15h01_40" border="0" alt="2010-11-30 15h01_40" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h01_40_thumb.png" width="640" height="182" /></a>-</p>
<p>For the grid itself, it’s <strong>Height</strong> and <strong>Width </strong>gets fixed so we’ll want to reset this to auto so the grid is free to resize as it’s content or container feels necessary.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h06_16.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 15h06_16" border="0" alt="2010-11-30 15h06_16" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h06_16_thumb.png" width="640" height="179" /></a></p>
<p>Now we can add a grid line by clicking on the top portion of our grid, and right after where the Rectangle ends:</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h49_09.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h49_09" border="0" alt="2010-11-30 14h49_09" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h49_09_thumb.png" width="240" height="137" /></a></p>
<p>then toggle the grid property (by clicking on the lock icon) until we get <strong>Pixel sized</strong>.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h52_22.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h52_22" border="0" alt="2010-11-30 14h52_22" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h52_22_thumb.png" width="240" height="94" /></a></p>
<p>We can leave the other column at star sized so it’ll take up the rest of the available space.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h51_56.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h51_56" border="0" alt="2010-11-30 14h51_56" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h51_56_thumb.png" width="240" height="100" /></a></p>
<p>With the TextBox selected, make sure the <strong>Width </strong>and <strong>Height</strong>&#160; is set to auto (if there is a value, you can use the button on the right of the field to set to auto), the <strong>HorizontalAlignment </strong>and <strong>VerticalAlignment </strong>are set to <strong>Justified </strong>and the margins are set to the distance you want.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h55_05.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 14h55_05" border="0" alt="2010-11-30 14h55_05" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-14h55_05_thumb.png" width="640" height="203" /></a></p>
<p>Now when you go back up to the UserControl scope, you’ll see the TextWrap in effect. Looking at this though, I might want to change the alignment/margins so that the rectangle is aligned to top instead of in the middle just to make it look nicer.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h11_13.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 15h11_13" border="0" alt="2010-11-30 15h11_13" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h11_13_thumb.png" width="273" height="162" /></a></p>
<p>To go back to editing the template, right click on the <strong>ColumnSeries –&gt; Edit Additional Templates –&gt; Edit Current –&gt; Edit LegendItemStyle</strong></p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h12_35.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 15h12_35" border="0" alt="2010-11-30 15h12_35" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h12_35_thumb.png" width="339" height="77" /></a></p>
<p>In my case, I chose top aligned with a bit of a top margin.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h14_27.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 15h14_27" border="0" alt="2010-11-30 15h14_27" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h14_27_thumb.png" width="640" height="185" /></a></p>
<p>Going back out to the UserControl scope, we’ll be able to see the effect. </p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h18_33.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 15h18_33" border="0" alt="2010-11-30 15h18_33" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h18_33_thumb.png" width="212" height="123" /></a></p>
<p>You can play around with how you want your legend to look and once your satisfied, it’s time to apply the style to the other series’. No you don’t to do that whole set of steps for each of them so don’t worry. Right click on the other column series-&gt;<strong> Edit Additional Templates –&gt; Edit LegendItemStyle –&gt; </strong>and this time select <strong>ApplyResource </strong>and you should see the style you created in the previous steps and click on that. In my case, I named the style LegendItemStyle.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h20_05.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 15h20_05" border="0" alt="2010-11-30 15h20_05" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h20_05_thumb.png" width="353" height="143" /></a></p>
<p>You’ll notice your legend automatically format itself the same way the previous column series did.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h22_34.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2010-11-30 15h22_34" border="0" alt="2010-11-30 15h22_34" src="http://aimeegurl.com/wp-content/uploads/2010/11/2010-11-30-15h22_34_thumb.png" width="205" height="148" /></a></p>
<p>And that’s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://aimeegurl.com/2010/11/30/will-it-blend-wrapping-the-text-on-silverlight-chart-legends/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Will it Blend: Custom Scrollbar in WPF</title>
		<link>http://aimeegurl.com/2010/07/11/customizing-the-scrollbar-in-wpf-with-no-xaml-typing/</link>
		<comments>http://aimeegurl.com/2010/07/11/customizing-the-scrollbar-in-wpf-with-no-xaml-typing/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 10:22:23 +0000</pubDate>
		<dc:creator>Aimee</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[expression blend]]></category>
		<category><![CDATA[no code]]></category>
		<category><![CDATA[will it blend]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://aimeegurl.com/2010/07/11/customizing-the-scrollbar-in-wpf-with-no-xaml-typing/</guid>
		<description><![CDATA[DISCLAIMER: I write this post more for myself because I tend to forget how to do things. There can very well be other proper ways of doing this, but this is the “good enough” solution, at least for me. I was playing around with WPF again since it’s been a while. I wanted to customize [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />
<p>DISCLAIMER: I write this post more for myself because I tend to forget how to do things. There can very well be other proper ways of doing this, but this is the “good enough” solution, at least for me. <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://aimeegurl.com/wp-content/uploads/2010/07/wlEmoticonsmile.png" /></p>
<p>I was playing around with WPF again since it’s been a while. I wanted to customize the scrollbar and I found it was quite a task. I finally figured out a simple way of doing it.</p>
<p>The look I wanted was a simple, thin, vertical bar (I guess you could do the same with the horizontal bar.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://aimeegurl.com/wp-content/uploads/2010/07/image_thumb.png" width="240" height="150" /></a></p>
<p>1. So we start with a ScrollViewer that contains a RichTextBox(or whatever you want) </p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://aimeegurl.com/wp-content/uploads/2010/07/image_thumb1.png" width="266" height="253" /></a>&#160;<a href="http://aimeegurl.com/wp-content/uploads/2010/07/image2.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px 6px 0px 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://aimeegurl.com/wp-content/uploads/2010/07/image_thumb2.png" width="266" height="252" /></a></p>
<p>2. Now we proceed to EditTemplate –&gt; Edit a Copy. </p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071116h48_17.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 16h48_17" border="0" alt="2010-07-11 16h48_17" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071116h48_17_thumb.png" width="546" height="485" /></a></p>
<p>3. You’re probably already familiar with this dialog box. Give your template a Name when you click okay, by default, it’ll add this to your window’s xaml. But if you want to later on reuse this template, choose the option to define it in a Resource dictionary. Later on, all you’ll have to do is add that resource dictionary to your project and you’ll be able to apply the style to your ScrollViewer.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071116h50_39.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 16h50_39" border="0" alt="2010-07-11 16h50_39" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071116h50_39_thumb.png" width="458" height="248" /></a></p>
<p>4. We’ll fix the VerticalScrollBar in this sample but you can very well do the same for HorizontalScrollBar. To start, right-click on PART_VerticalScrollBar and click on EditTemplate –&gt; Edit a Copy. Again, you’ll be asked to select a name and where you want to save this style. This time, we’re editing the ScrollBar component (previously was the entire ScrollViewer).</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071116h55_41.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 16h55_41" border="0" alt="2010-07-11 16h55_41" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071116h55_41_thumb.png" width="471" height="443" /></a></p>
<p>5. If you expand the template that you’re presented with, you’ll see the elements below. In my case, I want to delete the two RepeatButtons since clicking anywhere above and below the Thumb more or less does the same thing.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071116h56_50.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 16h56_50" border="0" alt="2010-07-11 16h56_50" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071116h56_50_thumb.png" width="565" height="320" /></a></p>
<p>5a. But lets say you wanted to edit the buttons, what we do, is draw out what we want the button to look like anywhere on the canvas. We’ll delete this later on. Here, we have a Grid that contains our desired button template.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h06_07.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 17h06_07" border="0" alt="2010-07-11 17h06_07" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h06_07_thumb.png" width="386" height="96" /></a></p>
<p>5b. What we’ll do now is right-click on the grid and select Make Into Control. A dialog box will appear that will ask you to select which control you want this grid to magically turn into. You’ll notice above that the buttons for scrolling up and down are RepeatButtons, so we can type into the search box to find the component, click to select and we’ll name it into something we will recognize later on, in my case, ScrollUpButton.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h10_00.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 17h10_00" border="0" alt="2010-07-11 17h10_00" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h10_00_thumb.png" width="500" height="577" /></a></p>
<p>5c. Now we’re editing the RepeatButton template. We can go ahead and delete the automatically generated ContentPresenter since we don’t need any content in our template.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h10_42.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 17h10_42" border="0" alt="2010-07-11 17h10_42" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h10_42_thumb.png" width="506" height="301" /></a></p>
<p>5d. You’ll notice that you can also go into the states tab to edit the look of your button on different states. </p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h12_24.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 17h12_24" border="0" alt="2010-07-11 17h12_24" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h12_24_thumb.png" width="492" height="425" /></a></p>
<p>5e. Once you’re done editing, you can go back to the Objects and Timeline tab and click on this button that will take you back to the ScrollbarTemplate</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/image3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://aimeegurl.com/wp-content/uploads/2010/07/image_thumb3.png" width="297" height="166" /></a></p>
<p>5f. Now to apply the style, select the first RepeatButton –&gt; Edit Template –&gt; Apply Resource –&gt; ScrollUpButton (or whatever you named your template)</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h16_34.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 17h16_34" border="0" alt="2010-07-11 17h16_34" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h16_34_thumb.png" width="692" height="551" /></a></p>
<p>5g. You’ll now see the button with the style you’ve defined. Now remember to delete that Grid turned Repeat button that we used to create the style or else, it’ll become part of your template/application <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://aimeegurl.com/wp-content/uploads/2010/07/wlEmoticonsmile.png" /></p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/image4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://aimeegurl.com/wp-content/uploads/2010/07/image_thumb4.png" width="233" height="116" /></a></p>
<p>6. Like I said, I’m deleting my up and down buttons because I don’t want them. You’ll notice that the grid this ScrollBar was defined in has Rows that hold the buttons and the thumb / track. I’ll need to delete the extra rows since I don’t need them now and I want the thumb and vertical bar to occupy the entire height. I tried deleting this through the designer but it only wreaked havoc (might be a user error) but I found the safest way to do this is to delete from the XAML code.&#160; Click on this button in the upper right corner of your design canvas to show the xaml editor. (Now you know why I said XAML typing instead of XAML editing)</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/image5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://aimeegurl.com/wp-content/uploads/2010/07/image_thumb5.png" width="794" height="179" /></a></p>
<p>7. What I’ll do now is delete the 1st and 3rd row definitions.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h21_17.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 17h21_17" border="0" alt="2010-07-11 17h21_17" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h21_17_thumb.png" width="321" height="440" /></a></p>
<p>8. Now I’ll see my scrollbar occupy the full height.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/image6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://aimeegurl.com/wp-content/uploads/2010/07/image_thumb6.png" width="678" height="379" /></a></p>
<p>9. Next, I want to change the look of the ScrollBar’s thumb. You’ll see that the type of component this is is a Thumb. So we can do as we did with the Repeat button to style this. Make into Control only works on single objects so if you have several objects you want to include in your template, just right-click –&gt; Group Into –&gt; Grid to make them one. </p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h33_27.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 17h33_27" border="0" alt="2010-07-11 17h33_27" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h33_27_thumb.png" width="370" height="266" /></a></p>
<p>10. Now you can follow the steps in 5b but this time, instead of RepeatButton, we select Thumb in the Make Into Control dialog.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h37_34.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 17h37_34" border="0" alt="2010-07-11 17h37_34" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h37_34_thumb.png" width="500" height="577" /></a></p>
<p>11. Now continue with 5f to go back to ScrollBar template editing and apply the template to the Thumb object. You’ll now see our ScrollBar has changed. Again, remember to delete that extra thumb that we used to create the style. </p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/image7.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://aimeegurl.com/wp-content/uploads/2010/07/image_thumb7.png" width="612" height="331" /></a></p>
<p>12. One last thing. Maybe you don’t want your ScrollBar to be as thick as this. So using the button in 5e, go back up to the ScrollViewer template. With the PART_VerticalScrollBar selected, go to the Properties tab and scroll down to the Style property. You’ll see that it’s highlighted in green which means it’s being bound to a local resource.&#160;&#160; </p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h44_18.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 17h44_18" border="0" alt="2010-07-11 17h44_18" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h44_18_thumb.png" width="914" height="550" /></a></p>
<p>13. Click on Edit Resource</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h45_59.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 17h45_59" border="0" alt="2010-07-11 17h45_59" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h45_59_thumb.png" width="228" height="240" /></a></p>
<p>14. You’ll then see our style, and if with it selected, you scroll down the Properties tab to the Width property, again you’ll see that the Width property is bound.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/image8.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://aimeegurl.com/wp-content/uploads/2010/07/image_thumb8.png" width="754" height="452" /></a></p>
<p>15. Click on the Advanced Options button (that little square) and select Reset. You should then be able to put in whatever width you want.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h50_49.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 17h50_49" border="0" alt="2010-07-11 17h50_49" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071117h50_49_thumb.png" width="246" height="81" /></a></p>
<p>16. Now when you click on the button in 5e. (Return scope button) it actually takes you to the topmost level which is the window. So you’ll have to do an Edit Template… on the ScrollViewer again to edit the ScrollViewerTemplate. (By the way, I’ve edited my Thumb template to make it look alright with a Width of 5, i.e., change the width of the topmost grid in the template to 5 and fixed the components inside to make it look good).</p>
<p>You’ll notice that the second column in the grid is set to auto-sized so you’ll want to click on that icon till it says pixel sized (locked lock)</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071118h05_37.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 18h05_37" border="0" alt="2010-07-11 18h05_37" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071118h05_37_thumb.png" width="580" height="215" /></a></p>
<p>17. With the handle selected (that inverted triangle there) you can now set the width property to what fits your template.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/image9.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://aimeegurl.com/wp-content/uploads/2010/07/image_thumb9.png" width="575" height="202" /></a></p>
<p>Now if you return scope to window, (5e), and run your app, you’ll now see your fully functional and newly styled ScrollViewer.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071118h11_04.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 18h11_04" border="0" alt="2010-07-11 18h11_04" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071118h11_04_thumb.png" width="222" height="240" /></a></p>
<p>hmm.. looks like there’s one more property you need to set. With the PART_VerticalScrollbar selected, set the Background property to No brush.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071118h13_05.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 18h13_05" border="0" alt="2010-07-11 18h13_05" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071118h13_05_thumb.png" width="764" height="557" /></a></p>
<p>This is the effect you will get. Note, I’ve also set the RichTextBox borders to zero to remove all borders.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/07/2010071118h17_06.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2010-07-11 18h17_06" border="0" alt="2010-07-11 18h17_06" src="http://aimeegurl.com/wp-content/uploads/2010/07/2010071118h17_06_thumb.png" width="222" height="240" /></a>    </p>
<p>And that’s it! </p>
]]></content:encoded>
			<wfw:commentRss>http://aimeegurl.com/2010/07/11/customizing-the-scrollbar-in-wpf-with-no-xaml-typing/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Panoramic Navigation on Windows Phone 7 with No Code!</title>
		<link>http://aimeegurl.com/2010/03/18/panoramic-navigation-on-windows-phone-7-with-no-code/</link>
		<comments>http://aimeegurl.com/2010/03/18/panoramic-navigation-on-windows-phone-7-with-no-code/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 06:19:09 +0000</pubDate>
		<dc:creator>Aimee</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[expression blend]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://aimeegurl.com/2010/03/18/panoramic-navigation-on-windows-phone-7-with-no-code-2/</guid>
		<description><![CDATA[I was reading through the UI Design and Interaction Guide for Windows Phone 7 Series and found out that there is currently no panoramic application template or control provided as part of the standard application platform. Nothing stops us from creating our own though. To make things easier, I’ve made a behavior library for everyone [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />I was reading through the <a href="http://bit.ly/d9Xiey">UI Design and Interaction Guide for Windows Phone 7 Series</a> and found out that there is currently no panoramic application template or control provided as part of the standard application platform. Nothing stops us from creating our own though.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image2.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb3.png" border="0" alt="image" width="640" height="289" /></a></p>
<p>To make things easier, I’ve made a behavior library for everyone to use that will handle flick gestures. I’ve also included a “GoToNextState” behavior which I based on <a title="http://gallery.expression.microsoft.com/en-us/MIXBehaviorPack" href="http://gallery.expression.microsoft.com/en-us/MIXBehaviorPack">http://gallery.expression.microsoft.com/en-us/MIXBehaviorPack</a>. If you want to follow along, you’ll need to download my <a href="http://cid-bdfb7845c22e26b6.skydrive.live.com/self.aspx/Projects/TechFriday/WPBehaviorsLibrary.dll">behavior library</a>. Also, if you don’t know where to get the Blend bits, check out this post: <a title="http://electricbeach.org/?p=460" href="http://electricbeach.org/?p=460">http://electricbeach.org/?p=460</a></p>
<p>So, let’s start by creating a new Windows Phone Application project in Blend 4.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image3.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb4.png" border="0" alt="image" width="444" height="383" /></a></p>
<p>You’ll be presented with a default layout. Obviously, your panoramic screen design will go outside the bounds of the “phone”. Layout your screen accordingly. This is what I did with mine.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image4.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb5.png" border="0" alt="image" width="571" height="389" /></a></p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image5.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb6.png" border="0" alt="image" width="286" height="299" /></a></p>
<p>Now that I have all my elements on screen, I’ll create 3 visual states, one for each active session. Let’s go into our States tab and add a state group called Sections. To do that, click on the icon with a green plus sign.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image6.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb7.png" border="0" alt="image" width="375" height="132" /></a></p>
<p>In the Sections state group, let’s add the 3 states and name them accordingly. For each state, let’s also move the Grid along the  x-axis.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image7.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb8.png" border="0" alt="image" width="720" height="307" /></a></p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image8.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb9.png" border="0" alt="image" width="748" height="308" /></a></p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image9.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb10.png" border="0" alt="image" width="654" height="305" /></a></p>
<p>We can also set the default transition to some built in easing functions to smooth out the user experience.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image10.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb11.png" border="0" alt="image" width="579" height="371" /></a></p>
<p>In my case, I used the back easing function but you can play around with the different functions to see what suits you. You can preview what the transitions look like by clicking on the <strong>Turn on transition preview </strong>button.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image11.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb12.png" border="0" alt="image" width="467" height="157" /></a></p>
<p>Okay, now we’re all set. The only thing left to do is enable state changing when a user flicks the screen either to the left or to the right. This is where we will be making use of the my WPBehaviorsLibrary. We’ll go into our asset library –&gt; behaviors tab and you’ll find a behavior called GoToNextState and GoToPreviousState:</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image12.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb13.png" border="0" alt="image" width="676" height="237" /></a></p>
<p>Drag and drop these two behaviors one by one to the LayoutRoot so that it looks like this:</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image13.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb14.png" border="0" alt="image" width="304" height="267" /></a></p>
<p>With one of the behaviors selected, go into the property inspector. You have a few options you can set (Loop &amp; UseTransitions) which are pretty self explanatory.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image14.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb15.png" border="0" alt="image" width="273" height="309" /></a></p>
<p>. You’ll notice there is also a trigger property. The default trigger type is an event trigger. Let’s go ahead and click New to select the FlickGestureTrigger.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image15.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb16.png" border="0" alt="image" width="390" height="605" /></a></p>
<p>When you click ok, you’ll find that the Gesture has a Direction property that you can set. Basically, we’re saying that the GoToPreviousState action gets fired when the user triggers a flick to the Right. Do the same for the GoToNextState behavior but with a flick to the Left.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image16.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb17.png" border="0" alt="image" width="307" height="365" /></a></p>
<p>And that’s it! Press f5 and select Windows Phone 7 Emulator, unless you’re lucky enough to have a Windows Phone 7 Device. <img class="wlEmoticon wlEmoticon-smile" src="http://aimeegurl.com/wp-content/uploads/2010/03/wlEmoticonsmile1.png" alt="Smile" /></p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/03/image17.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/03/image_thumb18.png" border="0" alt="image" width="423" height="237" /></a></p>
<p>You’ll get something like this:</p>
<p> <object id="scPlayer" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="446" height="788" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" /><param name="flashVars" value="thumb=http://content.screencast.com/users/jawss/folders/Jing/media/ca74bfc2-4fa5-4063-be34-e826163a3fe4/FirstFrame.jpg&amp;containerwidth=446&amp;containerheight=788&amp;content=http://content.screencast.com/users/jawss/folders/Jing/media/ca74bfc2-4fa5-4063-be34-e826163a3fe4/panorama.swf" /><param name="allowFullScreen" value="true" /><param name="scale" value="showall" /><param name="allowScriptAccess" value="always" /><param name="base" value="http://content.screencast.com/users/jawss/folders/Jing/media/ca74bfc2-4fa5-4063-be34-e826163a3fe4/" /><param name="src" value="http://content.screencast.com/users/jawss/folders/Jing/media/ca74bfc2-4fa5-4063-be34-e826163a3fe4/jingswfplayer.swf" /><param name="flashvars" value="thumb=http://content.screencast.com/users/jawss/folders/Jing/media/ca74bfc2-4fa5-4063-be34-e826163a3fe4/FirstFrame.jpg&amp;containerwidth=446&amp;containerheight=788&amp;content=http://content.screencast.com/users/jawss/folders/Jing/media/ca74bfc2-4fa5-4063-be34-e826163a3fe4/panorama.swf" /><param name="allowfullscreen" value="true" /><embed id="scPlayer" type="application/x-shockwave-flash" width="446" height="788" src="http://content.screencast.com/users/jawss/folders/Jing/media/ca74bfc2-4fa5-4063-be34-e826163a3fe4/jingswfplayer.swf" quality="high" bgcolor="#FFFFFF" allowscriptaccess="always" flashvars="thumb=http://content.screencast.com/users/jawss/folders/Jing/media/ca74bfc2-4fa5-4063-be34-e826163a3fe4/FirstFrame.jpg&amp;containerwidth=446&amp;containerheight=788&amp;content=http://content.screencast.com/users/jawss/folders/Jing/media/ca74bfc2-4fa5-4063-be34-e826163a3fe4/panorama.swf" allowfullscreen="true" base="http://content.screencast.com/users/jawss/folders/Jing/media/ca74bfc2-4fa5-4063-be34-e826163a3fe4/" scale="showall"></embed></object></p>
<p>After reading some more on the UI Guidelines, they’ve mentioned a few things about the title like moving at a different speed from the sections, etc. so I’ve tweaked the animations a bit,and now I have the title outside the overall grid, animating it separately. I also have different easing functions on the first and last page from the middle one. The result is this:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="505" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/II7z9qihof0&amp;hl=en_US&amp;fs=1&amp;hd=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="640" height="505" src="http://www.youtube.com/v/II7z9qihof0&amp;hl=en_US&amp;fs=1&amp;hd=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>You can get the code for this project as well as the library here. Also, although I’ve only managed to port  (i.e. copy paste) the States behavior from the <a href="http://gallery.expression.microsoft.com/en-us/MIXBehaviorPack">Mix Behavior Pack</a> to a Windows Phone behavior,  I’ve recompiled the pack to work with Silverlight 4. It’s in this folder as well.</p>
<p><iframe title ="Preview" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:98px;height:115px;padding:0;background-color:#fcfcfc;" src="http://cid-bdfb7845c22e26b6.office.live.com/embedicon.aspx/Projects/TechFriday/WP7%20-%20Panoramic%20Navigation%20with%20no%20code/PanoramaApplication.zip"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://aimeegurl.com/2010/03/18/panoramic-navigation-on-windows-phone-7-with-no-code/feed/</wfw:commentRss>
		<slash:comments>75</slash:comments>
		</item>
		<item>
		<title>TechFriday: iPadding V1 &#8211; The Designer Story</title>
		<link>http://aimeegurl.com/2010/02/05/ipadding-v1-the-designer-story/</link>
		<comments>http://aimeegurl.com/2010/02/05/ipadding-v1-the-designer-story/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 05:52:00 +0000</pubDate>
		<dc:creator>Aimee</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[expression blend]]></category>
		<category><![CDATA[techfriday]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://aimeegurl.com/?p=837</guid>
		<description><![CDATA[With the whole iPad buzz going around last week, I decided to build last friday’s TechFriday app around the theme. Introducing iPadding v1! It’s basically a WPF application that allows you to drag and drop shortcuts onto the screen and save it for when it’s presentation time. My desktop is constantly cluttered and as much [...]]]></description>
			<content:encoded><![CDATA[<p id="top" /><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image.png"><img style="margin: 0px 20px; display: inline; border-width: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb.png" border="0" alt="image" width="389" height="480" align="left" /></a>With the whole iPad buzz going around last week, I decided to build last friday’s TechFriday app around the theme.</p>
<p>Introducing iPadding v1! It’s basically a WPF application that allows you to drag and drop shortcuts onto the screen and save it for when it’s presentation time. My desktop is constantly cluttered and as much as I’d like to use the hide desktop icons features, I do want some shortcuts readily available. Even with the pinning feature of Windows 7, I just end up with a cluttered task bark instead <img class="wlEmoticon wlEmoticon-sad" src="http://aimeegurl.com/wp-content/uploads/2010/02/wlEmoticonsad.png" alt="Sad" /> What I’ve been doing till now is creating a folder with the shortcuts of everything I want to show so i just have that pinned (or open by default) onto my taskbar.</p>
<p>So for TechFriday, I decided to make this little app that will store shortcuts in a window that looks like the iPad (<a href="http://www.benzinga.com/did-apple-copy-the-ipad-from-the-p88-aapl">or should i say P88?)</a>.</p>
<p>Version 1 includes the following features:</p>
<ul>
<li>Drag &amp; Drop items onto the screen</li>
<li>Click and Delete shortcuts that you want removed</li>
<li>Double-clicking to start an application</li>
<li>ClickOnce deployment enabling ease of deployment and distributing updates</li>
<li>and of course, clicking the button formerly know as the start button to save your shortcuts and shut down <img class="wlEmoticon wlEmoticon-smile" src="http://aimeegurl.com/wp-content/uploads/2010/02/wlEmoticonsmile.png" alt="Smile" /></li>
</ul>
<p>You can check out the application at <a title="http://bit.ly/b7893s" href="http://bit.ly/b7893s">http://bit.ly/b7893s</a> and explore the source code here.</p>
<p>How I did it?</p>
<p><strong>iPadding States</strong></p>
<p>If you open up the project you’ll find the following state groups. (The third state is currently not supported in this release <img class="wlEmoticon wlEmoticon-smile" src="http://aimeegurl.com/wp-content/uploads/2010/02/wlEmoticonsmile.png" alt="Smile" />)</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image1.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb1.png" border="0" alt="image" width="308" height="208" /></a></p>
<p>The iPadLoading state simple sets the opacity of a canvas with the “broken window” logo to 100% while the iPadLoaded state does the reverse.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image2.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb2.png" border="0" alt="image" width="822" height="714" /></a></p>
<p><strong>iPadding Components</strong></p>
<p>For this version, we only have two major components to the app: <strong>icApps </strong>and <strong>btnStart</strong></p>
<p>Let’s start with the <strong>btnStart</strong> as it is the easiest. This control is basically a styled button.</p>
<p>1. Start by adding a button onto the screen, then right-clicking, Edit Template –&gt; Edit a Copy</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image3.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb3.png" border="0" alt="image" width="864" height="810" /></a></p>
<p>You’ll then be prompted with a dialog box that will allow you to specify properties of this style. First is the Name, second is where you want to define the style in. The default is set to <strong>This Document</strong> which means the style will only be visible in this screen/page/usercontrol. <strong>Application </strong>will allow the style to be visible to the other pages/windows/usercontrols in the application. You can also select <strong>Resource dictionary </strong>to put the style in a separate file altogether and allow you to import the Resource Dictionary along with all the styles defined in it in other projects and applications.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image4.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb4.png" border="0" alt="image" width="467" height="261" /></a></p>
<p><strong> </strong></p>
<p>For this button style, I made use of images to for 2 of the different button states: MouseOver and Normal.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image5.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb5.png" border="0" alt="image" width="302" height="136" align="left" /></a></p>
<p>The default style of the button contains the chrome and a ContentPresenter. The ContentPresenter is basically where Button.Content will be displayed. If you’ve been playing with WPF/Silverlight, you’ll know that you can not only assign text to as button contents, but images, videos and other controls as well.</p>
<p>In this case, I just want a simple image, so I can go ahead and delete the default contents and replace it with a grid that contains my button images. In this case, I added 2 images, one to depict the button in Normal state, and another on MouseOver state.</p>
<p>When you click on a state, you’ll notice the state recording turns on.Once this is so, you can start changing properties of your design elements to reflect your desired look.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image6.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb6.png" border="0" alt="image" width="590" height="492" /></a><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image7.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb7.png" border="0" alt="image" width="589" height="493" /></a></p>
<p>Now we’re pretty much done with the StartButton design. Let’s put in a stub where our developer can plug in the code to make the app function as it is supposed to. To do this, let’s first return to the Window Scope</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image8.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb8.png" border="0" alt="image" width="320" height="190" /></a></p>
<p>Next, while the button is selected, go to the properties tab an click on events.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image9.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb9.png" border="0" alt="image" width="320" height="98" /></a></p>
<p>Once the tab is activated, you can type in the method name you want called on the Click event</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image10.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb10.png" border="0" alt="image" width="320" height="186" /></a></p>
<blockquote><p>Doing this will activate the XAML editor in Blend and automatically insert the method stub for you or your developer to fill in once you are ready to start filling in the application logic. Let’s leave this for now and go on to the next component.</p></blockquote>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image11.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb11.png" border="0" alt="image" width="844" height="479" /></a></p>
<p>The next control is <strong>icApps </strong>is a styled ItemsControl that will contain all the apps that you drag and drop into the window. Let’s first go to our Asset Library and drop in the ItemsControl onto our Window. You might want to drop it into a Grid to fix the layout.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image12.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb12.png" border="0" alt="image" width="834" height="300" /></a></p>
<p>Next, we need to think about how we want to layout the items in our control. If you look at the iPhone, the apps are actually lined up in a 4 x 5 grid. However, since in the future, I’d like to be able to resize the screen and have the apps line up depending on the space, I’ll use a WrapPanel to manage the layout. To do this, I’ll right-click on the ItemsControl –&gt; Edit Additional Templates –&gt; Edit Layout of Items &#8211; &gt;Edit a Copy. Again this will bring you a dialog box that will allow you to name and specify where you want your style created.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image13.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb13.png" border="0" alt="image" width="968" height="553" /></a></p>
<p>You’ll notice that the default layout is a StackPanel, but we’ll go ahead and change this into a WrapPanel.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image14.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb14.png" border="0" alt="image" width="528" height="474" /></a></p>
<p>You might also want to ensure that the ScrollBarVisibilities are properly set. I’ll be disabling scrolling for this version till I figure out how I want to page / scroll through my items.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image15.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb15.png" border="0" alt="image" width="311" height="222" /></a></p>
<p>Now that we have the layout set, we’ll now take a look at the template for generated items. So same as before, right-click on the ItemsControl -&gt; Edit Additional Templates –&gt; Edit Generated Items –&gt; Edit a Copy. If you’re wondering why it’s “Edit a Copy”, WPF controls come with default templates that developers and designers can easily replace but because Blend needs to have a fall back in cases of new controls, the default templates are stored somewhere and are read-only for us. But we can always create our own style and set it as a default for all the controls in our project by selecting <strong>Apply to All </strong>in the <strong>Create Style Resource</strong> dialog.</p>
<p>I want the Apps to be visualize as buttons that can get focus when clicked so that the users can delete them if he chooses to, and launch the application when double clicked. I don’t want to recreate a control as the Button control can pretty much do what I need it to do. So what I’ll do in my data template is add a 120&#215;120 grid to constrain the button size, and put a button inside and style it as I want and for this I’ve created a style called AppButton style. that has the following:</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image16.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb16.png" border="0" alt="image" width="264" height="517" align="left" /></a>You’ll notice that since I’m styling a button, the template already comes with the common button states such as MouseOver and FocusStates. This will make it much easier for me to fix my controls visuals through states instead of having to code it all up myself.</p>
<p>If you look at the object tree, I have an image will I will later on show how I tie up to the Icon of whatever shortcut is dragged into my app. I have a text block that will also display the name of that shortcut, and two rectangles that will basically be my MouseOverVisual and FocusVisual. Both these visuals have an opacity of 0% by default, and I simply edit the corresponding states to set the opacity to 100%.</p>
<p>I mentioned that for the image and text block, I wanted it to be bound to whatever the icon and name was used in the shortcut dragged into the app. Later on we’ll be using the ShellObject defined in the <a title="http://code.msdn.microsoft.com/WindowsAPICodePack" href="http://code.msdn.microsoft.com/WindowsAPICodePack">http://code.msdn.microsoft.com/WindowsAPICodePack</a> The ShellObject data object has quite a number of properties but the one I’m intersted in would be Thumbnail, which is an Icon object which in turn has a MediumBitmapSource (medium because we’re looking at displaying bigger icons than the ones we see in details view of explorer) and Name, which will hold the filename on the shortcut.</p>
<p>As a designer, all I care about would be that those two properties of the data object will be present when the time comes. I can use data binding to link the properties of the data object with properties in my UI.</p>
<p>First off is the TextBlock. With the the TextBlock selected, I’ll head over to the properties panel and look for the text property since this is what I want to bind to the Name property of the data object. I can do so by clicking on the button right beside the Text textbox.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image17.png"><img style="display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb17.png" border="0" alt="image" width="293" height="48" /></a></p>
<p>I’ll then select Data Binding.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image18.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb18.png" border="0" alt="image" width="315" height="320" /></a></p>
<p>You can data bind this the Text property to virtually anything as you’ll see in the dialog box that pops up, from data fields, to other elements properties. In this case, since we don’t have access to our data objects just yet, I’ll go straight to Explicit Data Context and tick the “Use a custom path expression” and put in the Name property. Again as a designer, I don’t have to care where that value comes from but i know that whatever data object is bound to this button, I’ll get access to a property called Name that will hold the name of the application or shortcut of the app I want to run.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image19.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb19.png" border="0" alt="image" width="618" height="583" /></a></p>
<p>I’ll do the same for the img object with the source property. This time, I’m binding it to “Thumbnail.MediumBitmapSource” since my developer tells me, there’s an existing object that we can use and that property is going to give me the filename of the icon i can use in my button.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image20.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb20.png" border="0" alt="image" width="609" height="579" /></a></p>
<p>Now that’s done, let’s help out our developer a little bit.We’ve decided that the behavior of this app is such that if a button is clicked, it’ll bring focus to that button. This is already the default behavior of a button and since we’ve only styled a button and not made our own, we won’t have to worry about building that behavior. The next behavior is that when double clicked, it runs the application associated with it. To do this, let’s exit scope one level up to the AppButton. We can either do as we did previously by clicking on the up arrow <a href="http://aimeegurl.com/wp-content/uploads/2010/02/image21.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb21.png" border="0" alt="image" width="211" height="32" /></a>or by clicking AppButton on the bread crumb bar at the top of the XAML designer page: <a href="http://aimeegurl.com/wp-content/uploads/2010/02/image22.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb22.png" border="0" alt="image" width="320" height="70" /></a> </p>
<p>With the AppButton selected, we’ll go to the events tab <a href="http://aimeegurl.com/wp-content/uploads/2010/02/image23.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb23.png" border="0" alt="image" width="51" height="33" /></a>on the Properties page, go to MouseDoubleClick and type in a name of method that will hold the code to run the shortcut associated to the button. <img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb24.png" border="0" alt="image" width="278" height="31" />Once we press enter, we’ll be brought to the code behind and we can write a little note to our developer to put in that piece of code here. If as a designer, later on you feel that it’ll be better to have the application run at a different event, you can simply move that method name to another event in the events list, and your developer won’t have to change their code.</p>
<p><a href="http://aimeegurl.com/wp-content/uploads/2010/02/image24.png"><img style="margin: 0px 20px; display: inline; border: 0px;" title="image" src="http://aimeegurl.com/wp-content/uploads/2010/02/image_thumb25.png" border="0" alt="image" width="657" height="112" /></a></p>
<p>Once that’s done, we can exit again till we’re all the way up on the window level. What we have done is basically create an ItemsControl with our custom style that displays a square button and a text block (as well as some visuals for mouse over and focus states). We’ve styled these buttons in such a way that the images and textblocks are bound to properties Name and Thumbnail.MediumBitmapSource. The idea here is that our developer will eventually bind this ItemsControl with a list of ShellObjects which we are told have those properties. Each shell object will be bound to a generated item with the template we defined. We’ve also created a method for our developer to implement that runs the associated application when the button is double clicked.</p>
<p>Next post will cover the developer portion of this application. <img class="wlEmoticon wlEmoticon-smile" src="http://aimeegurl.com/wp-content/uploads/2010/02/wlEmoticonsmile.png" alt="Smile" /> For now, you can download and try out the application on <a href="http://www.badgorilla.net/ipadding">http://www.badgorilla.net/ipadding</a></p>
]]></content:encoded>
			<wfw:commentRss>http://aimeegurl.com/2010/02/05/ipadding-v1-the-designer-story/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

