<?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>Veracity Solutions Blog &#187; How To&#8230;</title>
	<atom:link href="http://blogs.veracitysolutions.com/category/how-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.veracitysolutions.com</link>
	<description>Software Consulting That Rocks</description>
	<lastBuildDate>Thu, 22 Apr 2010 17:21:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How To Build a Storyboard Animation for Silverlight in C#</title>
		<link>http://blogs.veracitysolutions.com/how-to-build-a-storyboard-animation-in-c-sharp/</link>
		<comments>http://blogs.veracitysolutions.com/how-to-build-a-storyboard-animation-in-c-sharp/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 17:34:10 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Advanced Tutorial]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://blogs.veracitysolutions.com/?p=667</guid>
		<description><![CDATA[One of the things that I’ve gotten somewhat frustrated in my Silverlight and WPF work is the fact that sometimes (not often, but sometimes), I really need to build a storyboard or keyframe animation programmatically. Especially if you’re doing anything relating to information visualization and you need to create animations for path points, it can [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things that I’ve gotten somewhat frustrated in my Silverlight and WPF work is the fact that sometimes (not often, but sometimes), I really need to build a storyboard or keyframe animation programmatically. Especially if you’re doing anything relating to information visualization and you need to create animations for path points, it can be impractical to build a XAML animation and change the values to whatever you need.</p>
<p>By the way, if you need additional help on in depth Silvelright animation, check out Jeff Paries’ excellent <a href="http://www.amazon.com/gp/product/1430215690?ie=UTF8&amp;tag=irrationalopt-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1430215690">Foundation Silverlight 2 Animation</a><img src="http://www.assoc-amazon.com/e/ir?t=irrationalopt-20&amp;l=as2&amp;o=1&amp;a=1430215690" width="1" height="1" border="0" alt="" style="border:none !important;margin:0px !important" />.</p>
<p>In response to this dearth, this is a tutorial on how to create a storyboard in code (specifically C#). Basically, I’m just going to show a XAML animation (which is what I’m used to dealing with because Blend builds them for me) and then show how to create that animation in C#. </p>
<p>This animation will animate the first point in a path to the X,Y coordinate 1,1. </p>
<p>XAML animation:</p>
<p><span style="color: blue">&lt;</span><span style="color: #a31515">Storyboard </span><span style="color: blue">&gt;     <br />&#160;&#160;&#160; &lt;</span><span style="color: #a31515">PointAnimationUsingKeyFrames&#160; <br />&#160;&#160;&#160;&#160;&#160; </span><span style="color: red">BeginTime</span><span style="color: blue">=&quot;00:00:00&quot;&#160; <br />&#160;&#160;&#160;&#160;&#160; </span><span style="color: red">Storyboard.TargetName</span><span style="color: blue">=&quot;myPath&quot;&#160; <br /></span><span style="color: red"><font color="#0000ff">&#160;&#160;&#160;&#160;&#160; </font>Storyboard.TargetProperty</span><span style="color: blue">=&quot;(Path.Data).(PathGeometry.Figures)[0].(PathFigure.Segments)[0].(LineSegment.Point)&quot;&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">EasingPointKeyFrame </span><span style="color: red">KeyTime</span><span style="color: blue">=&quot;00:00:01&quot; </span><span style="color: red">Value</span><span style="color: blue">=&quot;1,1&quot; /&gt;     <br />&#160;&#160;&#160; &lt;/</span><span style="color: #a31515">PointAnimationUsingKeyFrames</span><span style="color: blue">&gt;     <br />&lt;/</span><span style="color: #a31515">Storyboard</span><span style="color: blue">&gt;</span></p>
<p> <a href="http://11011.net/software/vspaste"></a>
<p>C# animation:</p>
<p><span style="color: green">//Code equivalent of: &lt;Storyboard&gt;     <br /></span><span style="color: #2b91af">Storyboard </span>myNewStoryBoard = <span style="color: blue">new </span><span style="color: #2b91af">Storyboard</span>();    </p>
<p><span style="color: green">//Code equivalent of:      <br />//&lt;PointAnimationUsingKeyFrames       <br />//&#160;&#160;&#160; BeginTime=&quot;00:00:00&quot;       <br />//&#160;&#160;&#160; Storyboard.TargetName=&quot;myPath&quot;       <br />//&#160;&#160;&#160; Storyboard.TargetProperty=&quot;(Path.Data).(PathGeometry.Figures)[0].(PathFigure.Segments)[0].(LineSegment.Point)&quot;&gt;      <br /></span><span style="color: #2b91af">PointAnimationUsingKeyFrames </span>myPointAnimation = <span style="color: blue">new </span><span style="color: #2b91af">PointAnimationUsingKeyFrames</span>();    <br />myPointAnimation.BeginTime = <span style="color: blue">new </span><span style="color: #2b91af">TimeSpan</span>(0);    <br /><span style="color: #2b91af">Storyboard</span>.SetTargetName(myPointAnimation, myPath.Name);    <br /><span style="color: #2b91af">Storyboard</span>.SetTarget(myPointAnimation, myPath);    <br /><span style="color: #2b91af">Storyboard</span>.SetTargetProperty(myPointAnimation,    <br />&#160;&#160;&#160; <span style="color: blue">new </span><span style="color: #2b91af">PropertyPath</span>(<span style="color: #a31515">&quot;(Path.Data).(PathGeometry.Figures)[0].(PathFigure.Segments)[0].(LineSegment.Point)&quot;</span>));    </p>
<p><span style="color: green">//Code equivalen of:     <br />// &lt;EasingPointKeyFrame KeyTime=&quot;00:00:01&quot; Value=&quot;1,1&quot; /&gt;      <br /></span><span style="color: #2b91af">EasingPointKeyFrame </span>targetKeyFrame = <span style="color: blue">new </span><span style="color: #2b91af">EasingPointKeyFrame</span>();    <br />targetKeyFrame.KeyTime = <span style="color: #2b91af">KeyTime</span>.FromTimeSpan(<span style="color: #2b91af">TimeSpan</span>.FromMilliseconds(1000));    <br />targetKeyFrame.Value = <span style="color: blue">new </span><span style="color: #2b91af">Point</span>(1, 1);    </p>
<p><span style="color: green">//Add the keyFrame to the animation     <br /></span>myPointAnimation.KeyFrames.Add(targetKeyFrame);    </p>
<p><span style="color: green">//Add the animation to the Storyboard     <br /></span>myNewStoryBoard.Children.Add(myPointAnimation);    </p>
<p><span style="color: green">//Now your storyboard is ready to go&#8230; just start it     <br /></span>myNewStoryBoard.Begin();</p>
<p> <a href="http://11011.net/software/vspaste"></a>
<p>There is not, as far as I know, any way to assign a x:Name property to an object in code. Why? Because if you created the object in code, you should already have a way of accessing it. So the example above is an animation that is looking for a path named “myPath” that is already in the XAML. </p>
<p>If you created your path programmatically (it doesn’t exist in the XAML, but exists in the code), replace this line:</p>
<p><span style="color: #2b91af">Storyboard</span>.SetTargetName(myPointAnimation, myPath.Name);</p>
<p> <a href="http://11011.net/software/vspaste"></a>
<p>with this line.</p>
<p><span style="color: #2b91af">Storyboard</span>.SetTarget(myPointAnimation, myPath);</p>
<p> <a href="http://11011.net/software/vspaste"></a>
<p>where myPath is of type Path and refers to the actual Path you want to animate.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/how-to-build-a-storyboard-animation-in-c-sharp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How To Animate a Changing Property in a Custom Control in Silverlight</title>
		<link>http://blogs.veracitysolutions.com/how-to-animate-a-changing-property-in-a-custom-control-in-silverlight/</link>
		<comments>http://blogs.veracitysolutions.com/how-to-animate-a-changing-property-in-a-custom-control-in-silverlight/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 16:10:44 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Advanced Tutorial]]></category>
		<category><![CDATA[Custom Controls]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Templates]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[Custom Control]]></category>
		<category><![CDATA[DependencyProperty]]></category>

		<guid isPermaLink="false">http://blogs.veracitysolutions.com/?p=661</guid>
		<description><![CDATA[For my recent visualization, I created a custom control in Silverlight that animated the color of a Path every time a “Fill” property on the control was changed. I thought I would pass along my learning from this process.
First thing I learned was that you cannot use TemplateBinding in a Storyboard (I think). I asked [...]]]></description>
			<content:encoded><![CDATA[<p>For my recent visualization, I created a custom control in Silverlight that animated the color of a Path every time a “Fill” property on the control was changed. I thought I would pass along my learning from this process.</p>
<p>First thing I learned was that you cannot use TemplateBinding in a Storyboard (I think). I asked this question on Stack Overflow and I haven’t gotten an answer. But I’m pretty sure that in Silverlight you cannot use TemplateBinding to attach a property to a KeyFrame value. This means that you have to have a pointer in the control code the allows access to the KeyFrame so you can update the value.</p>
<p>I’ll walk through the conceptual part of animating a property in a Custom Control in Sivlerlight and then walk through the code to it.</p>
<p><b>Step 1: Create a PART to your control to hold the Storyboard and a PART to hold the KeyFrame you want to manipulate</b></p>
<p>I cover <a href="http://blogs.veracitysolutions.com/how-to-create-a-part-in-your-silverlight-custom-control/">how to make a PART to your control here</a> because it was too much to put into a single blog post. You&#8217;re going to want to make your Storyboard a PART that is accessed via resources (via MyControlName.Resources[MyStoryboardName]) and your KeyFrame should be a PART that is accessed the normal way (via the GetTemplateChild(MyKeyFrameName) method). </p>
<p> <a href="http://11011.net/software/vspaste"></a>
<p><b>Step 2: Create the DependencyProperty you want to drive the animation</b></p>
<p>Yet another chance for me to endlessly flog <a href="http://blog.nerdplusart.com/archives/silverlight-code-snippets">Robby Ingebretsen’s awesome Silverlight Code Snippets</a>. If you use these, use ‘sldpc’, which is the DependencyProperty with a property changed callback. We want to manually fire the animation when the property changes, so we’re going to do that in the callback.</p>
<p>If you don’t want to use Robby’s stuff, here’s the code for a DependencyProperty with a property changed callback. Because my visualization animates the color, I called my property “Fill”. </p>
<p><span style="color: blue">public </span><span style="color: #2b91af">SolidColorBrush </span>Fill    <br />{    <br />&#160;&#160;&#160; <span style="color: blue">get </span>{ <span style="color: blue">return </span>(<span style="color: #2b91af">SolidColorBrush</span>)GetValue(FillProperty); }    <br />&#160;&#160;&#160; <span style="color: blue">set </span>{ SetValue(FillProperty, <span style="color: blue">value</span>); }    <br />}    </p>
<p><span style="color: blue">public static readonly </span><span style="color: #2b91af">DependencyProperty </span>FillProperty =    <br />&#160;&#160;&#160; <span style="color: #2b91af">DependencyProperty</span>.Register(<span style="color: #a31515">&quot;Fill&quot;</span>, <span style="color: blue">typeof</span>(<span style="color: #2b91af">SolidColorBrush</span>), <span style="color: blue">typeof</span>(<span style="color: #2b91af">County</span>),     <br />&#160;&#160;&#160; <span style="color: blue">new </span><span style="color: #2b91af">PropertyMetadata</span>(<span style="color: blue">new </span><span style="color: #2b91af">SolidColorBrush</span>(<span style="color: #2b91af">Color</span>.FromArgb(0, 0, 0, 0)), <span style="color: blue">new </span><span style="color: #2b91af">PropertyChangedCallback</span>(OnFillChanged)));</p>
<p> <a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a>
<p><b>Step 3: Hook up a property changed callback and run the animation</b></p>
<p>Then, all you need to do is go into the property changed callback that you have created and assign your the new valie of the property to the keyframe value of the animation you want to run. Then run the animation.</p>
<p><span style="color: blue">private static void </span>OnFillChanged(<span style="color: #2b91af">DependencyObject </span>d, <span style="color: #2b91af">DependencyPropertyChangedEventArgs </span>e)    <br />{    <br />&#160;&#160;&#160; <span style="color: #2b91af">MyControlType </span>thisControl = d <span style="color: blue">as </span><span style="color: #2b91af">MyControlType</span>;    <br />&#160;&#160;&#160; <span style="color: blue">if </span>((thisControl != <span style="color: blue">null</span>) &amp;&amp; (thisControl._myStoryboard != <span style="color: blue">null</span>))    <br />&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #2b91af">SolidColorBrush </span>newBrushHolder = (<span style="color: #2b91af">SolidColorBrush</span>)e.NewValue;    </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; thisCounty._myKeyFrame.Value = newBrushHolder.Color;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; thisCounty._myStoryboard.Begin();    <br />&#160;&#160;&#160; }    <br />}</p>
<p> <a href="http://11011.net/software/vspaste"></a>
<p>And now every time you change that value in the control, it will animate to the new value. Simple as that. </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/how-to-animate-a-changing-property-in-a-custom-control-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Silverlight Buttons with Rounded Corners (The Super Easy Way)</title>
		<link>http://blogs.veracitysolutions.com/silverlight-buttons-with-rounded-corners-the-super-easy-way/</link>
		<comments>http://blogs.veracitysolutions.com/silverlight-buttons-with-rounded-corners-the-super-easy-way/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 00:49:25 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Behaviors]]></category>
		<category><![CDATA[buttons]]></category>
		<category><![CDATA[cornerradius]]></category>
		<category><![CDATA[Pete Blois]]></category>

		<guid isPermaLink="false">http://blogs.veracitysolutions.com/?p=626</guid>
		<description><![CDATA[Download the “Silverlight Buttons With Rounded Corners” project files
This is a really silly but effective way of giving a button rounded corners without having to create a custom control template for that Button. 
First, install Pete Blois’ Expression Blend Samples. It’s a set of Behaviors and Triggers for Blend. For reasons I don’t really understand, [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.designersilverlight.com/wp-content/uploads/2009/08/RoundedButtonEasyTutorial.zip'>Download the “Silverlight Buttons With Rounded Corners” project files</a></p>
<p>This is a really silly but effective way of giving a button rounded corners without having to create a custom control template for that Button. </p>
<p>First, install <a href="http://expressionblend.codeplex.com/">Pete Blois’ Expression Blend Samples</a>. It’s a set of Behaviors and Triggers for Blend. For reasons I don’t really understand, these don’t automatically show up in my Blend Behaviors list, so if you have the same problem (or if you don’t want to install all the behaviors) follow these steps:</p>
<ol>
<li>create a new class in your project and name it ClippingBehavior.cs</li>
<li>copy <a href='http://www.designersilverlight.com/wp-content/uploads/2009/08/ClippingBehaviorText.txt'>all the code in this text file</a> into your class, replacing the ClippingBehavior class that was auto-generated</li>
<li>drag a behavior onto your canvas and delete it. This is by far the quickest and easiest way of getting the appropriate references added to your project. Sad but true.</li>
<li>Add “<span style="color: blue">using </span>System.Windows.Interactivity;” to your ClippingBehavior.cs references.</li>
<li>Hit F5</li>
</ol>
<p>OK… with the behaviors added into Blend Assets menu, create a Border with the rounded corners you want your button to have. In order to show that this is pretty flexible, I gave my border a CornerRadius of “20,2,20,2”</p>
<p>Now, put a Grid inside of that border and a button inside of the grid. Give your Button has a negative margin at least equal to the largest CornerRadius margin. It should look something like this:</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image0013.png"><img style="border-bottom: 0px;border-left: 0px;border-top: 0px;border-right: 0px" border="0" alt="clip_image001" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image001_thumb2.png" width="130" height="73" /></a>&#160;<a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image0014.png"><img style="border-bottom: 0px;border-left: 0px;border-top: 0px;border-right: 0px" border="0" alt="clip_image001[4]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image0014_thumb.png" width="213" height="162" /></a></p>
<p>Now, go to the Behaviors section in Blend and choose ClippingBehavior and drag it onto the Grid. </p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image0016.png"><img style="border-bottom: 0px;border-left: 0px;border-top: 0px;border-right: 0px" border="0" alt="clip_image001[6]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image0016_thumb.png" width="142" height="72" /></a></p>
<p>Give it a Margin equal to your BorderThickness and give it the same CornerRadius as your Border. </p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image0018.png"><img style="border-bottom: 0px;border-left: 0px;border-top: 0px;border-right: 0px" border="0" alt="clip_image001[8]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image0018_thumb.png" width="246" height="74" /></a></p>
<p>One last thing, make sure that your Border has the same BorderBrush as your Button. You can do that by clicking on the box next to the BorderBrush property and going to “DataBinding”.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image00110.png"><img style="border-bottom: 0px;border-left: 0px;border-top: 0px;border-right: 0px" border="0" alt="clip_image001[10]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image00110_thumb.png" width="209" height="253" /></a></p>
<p>Select the “Element Property” tab, find the button you’re giving rounded corners and select the “BorderBrush” property from the Button.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image00112.png"><img style="border-bottom: 0px;border-left: 0px;border-top: 0px;border-right: 0px" border="0" alt="clip_image001[12]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image00112_thumb.png" width="598" height="164" /></a></p>
<p>And you’re good to go. Now this doesn’t really give the actual Button rounded corners, but it sure does look that way. </p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image00114.png"><img style="border-bottom: 0px;border-left: 0px;border-top: 0px;border-right: 0px" border="0" alt="clip_image001[14]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image00114_thumb.png" width="177" height="121" /></a></p>
<p>And you’ve saved yourself a good deal of heartache (and a whole ton of generated code) because you don’t have to create a whole new Button template just to change some corners on one or two buttons. </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/silverlight-buttons-with-rounded-corners-the-super-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a Programmatic Path in Silverlight (or WPF)</title>
		<link>http://blogs.veracitysolutions.com/creating-a-programmatic-path-in-silverlight-or-wpf/</link>
		<comments>http://blogs.veracitysolutions.com/creating-a-programmatic-path-in-silverlight-or-wpf/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 01:59:19 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Advanced Tutorial]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Path]]></category>
		<category><![CDATA[Programmatic Path]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blogs.veracitysolutions.com/?p=620</guid>
		<description><![CDATA[Download Project Files for Creating a Programmatic Path in Silverlight or WPF 
(Note: The project is in Silverlight, but if you copy and paste the code into a WPF project, it should work without any changes)
Have you ever wanted to create a Path programmatically or create a Path in code behind or dynamically build a [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.designersilverlight.com/wp-content/uploads/2009/08/ProgrammaticPathTutorial.zip'>Download Project Files for Creating a Programmatic Path in Silverlight or WPF</a> </p>
<p>(Note: The project is in Silverlight, but if you copy and paste the code into a WPF project, it should work without any changes)</p>
<p>Have you ever wanted to create a Path programmatically or create a Path in code behind or dynamically build a Path or hand code a Path in Silverlight or WPF? </p>
<p>Yes, I just said the same thing 4 different ways, but I’m trying to cast a wide net for Google to catch. One of the biggest troubles I have when I’m trying to do something new is that I don’t always know the proper terminology, so I try to think of all the ways people might want to ask the question.</p>
<p>I’ve been playing around with a good number of information visualization concepts recently and one thing that I’ve found that I needed was the ability to create a path programmatically. </p>
<p>One way to do that is to tackle and fully grok the Path data code system. (Good guides to it are <a href="http://msdn.microsoft.com/en-us/library/cc189041(VS.95).aspx">here</a> and <a href="http://www.c-sharpcorner.com/UploadFile/mahesh/PathInSL03252009005946AM/PathInSL.aspx">here</a>.) This system is really cool, but (unless I’ve missed something) they cannot be animated. </p>
<p>I wanted to build a path based off a data set, but that means that I have to build it programmatically. I didn’t find a lot of useful stuff on how to do this, so I thought I’d throw some out there.</p>
<p>First, because I’m a XAML guy, I’m going to provide a simple XAML example of a Path that can be animated:</p>
<blockquote><p><span style="color: blue">&lt;</span><span style="color: #a31515">Path </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&quot;MyPath&quot; </span><span style="color: red">Fill</span><span style="color: blue">=&quot;#FFA30000&quot; </span><span style="color: red">Stroke</span><span style="color: blue">=&quot;Black&quot; </span><span style="color: red">Width</span><span style="color: blue">=&quot;100&quot; </span><span style="color: red">Height</span><span style="color: blue">=&quot;100&quot;&gt;     <br />&#160;&#160;&#160; &lt;</span><span style="color: #a31515">Path.Data</span><span style="color: blue">&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">PathGeometry </span><span style="color: red">FillRule</span><span style="color: blue">=&quot;EvenOdd&quot;&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">PathFigure </span><span style="color: red">IsClosed</span><span style="color: blue">=&quot;True&quot; </span><span style="color: red">StartPoint</span><span style="color: blue">=&quot;0,0&quot;&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">LineSegment </span><span style="color: red">Point</span><span style="color: blue">=&quot;0,100&quot;/&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">LineSegment </span><span style="color: red">Point</span><span style="color: blue">=&quot;100,100&quot;/&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;</span><span style="color: #a31515">LineSegment </span><span style="color: red">Point</span><span style="color: blue">=&quot;100,0&quot;/&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/</span><span style="color: #a31515">PathFigure</span><span style="color: blue">&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/</span><span style="color: #a31515">PathGeometry</span><span style="color: blue">&gt;     <br />&#160;&#160;&#160; &lt;/</span><span style="color: #a31515">Path.Data</span><span style="color: blue">&gt;     <br />&lt;/</span><span style="color: #a31515">Path</span><span style="color: blue">&gt;</span></p>
<p><span style="color: blue"></span> </p></blockquote>
<p>This path is a simple square and looks like this:</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image0012.png"><img style="border-bottom: 0px;border-left: 0px;border-top: 0px;border-right: 0px" border="0" alt="clip_image001" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image001_thumb1.png" width="141" height="133" /></a></p>
<p>Now, let’s assume you want to recreate this programmatically using a collection of points that represent X,Y coordinates. If you’re using an ObservableCollection of Points (like I am) you can use the following method to return an the appropriate path.</p>
<blockquote><p><span style="color: #2b91af">Path </span>createPath(<span style="color: #2b91af">ObservableCollection</span>&lt;<span style="color: #2b91af">Point</span>&gt; rawData)    <br />{    </p>
<p>&#160;&#160;&#160; <span style="color: #2b91af">Path </span>FinalPath = <span style="color: blue">new </span><span style="color: #2b91af">Path</span>();    <br />&#160;&#160;&#160; <span style="color: #2b91af">PathGeometry </span>FinalPathGeometry = <span style="color: blue">new </span><span style="color: #2b91af">PathGeometry</span>();    <br />&#160;&#160;&#160; <span style="color: #2b91af">PathFigure </span>PrimaryFigure = <span style="color: blue">new </span><span style="color: #2b91af">PathFigure</span>();    </p>
<p>&#160;&#160;&#160; <span style="color: green">//if you want the path to be a shape, you want to close the PathFigure     <br />&#160;&#160;&#160; //&#160;&#160; that makes up the Path. If you want it to simply by a line, set      <br />&#160;&#160;&#160; //&#160;&#160; PrimaryFigure.IsClosed = false;      <br />&#160;&#160;&#160; </span>PrimaryFigure.IsClosed = <span style="color: blue">true</span>;    <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; PrimaryFigure.StartPoint = rawData[0];    </p>
<p>&#160;&#160;&#160; <span style="color: #2b91af">PathSegmentCollection </span>LineSegmentCollection = <span style="color: blue">new </span><span style="color: #2b91af">PathSegmentCollection</span>();    </p>
<p>&#160;&#160;&#160; <span style="color: blue">for </span>(<span style="color: blue">int </span>i = 1; i &lt; rawData.Count; i++)    <br />&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #2b91af">LineSegment </span>newSegment = <span style="color: blue">new </span><span style="color: #2b91af">LineSegment</span>();    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; newSegment.Point = rawData[i];    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; LineSegmentCollection.Add(newSegment);    <br />&#160;&#160;&#160; }    </p>
<p>&#160;&#160;&#160; PrimaryFigure.Segments = LineSegmentCollection;    <br />&#160;&#160;&#160; FinalPathGeometry.Figures.Add(PrimaryFigure);    <br />&#160;&#160;&#160; FinalPath.Data = FinalPathGeometry;    </p>
<p>&#160;&#160;&#160; <span style="color: blue">return </span>FinalPath;    <br />}</p>
</blockquote>
<p>Once you have the path in place, you can just add it to your layout and it should show up. If you’re still confused, you can download the project that I created this in and walk through the rest of it yourself. </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/creating-a-programmatic-path-in-silverlight-or-wpf/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>How To Create A ListBox with CheckBoxes (or RadioButtons) In Silverlight 3</title>
		<link>http://blogs.veracitysolutions.com/how-to-create-a-listbox-with-checkboxes-or-radiobuttons-in-silverlight-3/</link>
		<comments>http://blogs.veracitysolutions.com/how-to-create-a-listbox-with-checkboxes-or-radiobuttons-in-silverlight-3/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 16:38:10 +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[Binding]]></category>
		<category><![CDATA[CheckBox]]></category>
		<category><![CDATA[ListBox]]></category>
		<category><![CDATA[RadioButton]]></category>
		<category><![CDATA[RelativeSource]]></category>
		<category><![CDATA[Silverlight 3]]></category>

		<guid isPermaLink="false">http://blogs.veracitysolutions.com/?p=612</guid>
		<description><![CDATA[To set the scene: You have a ListBox that is being populated by some collection and you want the user to scroll through the ListBox and either check a bunch of things or check one thing. Basically, you want a list of checkable items. If this is what you’re trying to do, this is the [...]]]></description>
			<content:encoded><![CDATA[<p>To set the scene: You have a ListBox that is being populated by some collection and you want the user to scroll through the ListBox and either check a bunch of things or check one thing. Basically, you want a list of checkable items. If this is what you’re trying to do, this is the tutorial that lets you do it without any code… simply by applying a style to your ListBox. </p>
<p>Download finished tutorial: <a href='http://www.designersilverlight.com/wp-content/uploads/2009/08/ListBoxCheckBoxTutorial.zip'>ListBox With CheckBoxes (or RadioButtons) Project in Silverlight 3 </a>
 </p>
<p><a href="http://designersilverlight.com/SilverlightSamples/ListBoxCheckBox/">Go here to see the final result</a>.</p>
<p>First, you should know right off the bat that this tutorial is for <strong>Silverlight 3 only</strong>. It uses a data binding functionality called RelativeSource binding that isn’t available in earlier versions of Silverlight.</p>
<p>OK… to start out, right click on your ListBox and go to:</p>
<p>Edit Additional Templates –&gt; Edit Generated Item Container (ItemContainerStyle) –&gt; Edit a Copy…</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image001.png"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" border="0" alt="clip_image001" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image001_thumb.png" width="602" height="90" /></a></p>
<p>Name your new template and Blend will generate the default ItemContainerStyle for the ListBox.</p>
<p>Split up the grid so that there is room for your CheckBox or RadioButton. I’m going to put mine on the left, set HorizonalAlignment and VerticalAlignment to “Center”, reset the Content property&quot; and make the whole thing twice as big by setting the RenderTransform X and Y to 2.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image0015.png"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" border="0" alt="clip_image001[5]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image0015_thumb.png" width="278" height="123" /></a></p>
<p>If you’re really picky about making sure that your CheckBox is centered appropriately, change the Width and Height to “16”.</p>
<p>OK… so we’ve got the CheckBox in there, but it doesn’t really do anything. So let’s set the binding so that it works. Sadly, Blend doesn’t have an obvious way (that I can see) of setting a RelativeSource binding, so just type this into your CheckBox (or RadioButton):</p>
<pre><span style="color: red">IsChecked</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">RelativeSource</span><span style="color: blue">={</span><span style="color: #a31515">RelativeSource </span><span style="color: red">TemplatedParent</span><span style="color: blue">}, </span><span style="color: red">Path</span><span style="color: blue">=IsSelected, </span><span style="color: red">Mode</span><span style="color: blue">=TwoWay}&quot;</span></pre>
<p> This binding will make it so that when the user selects or unselects an item, the CheckBox or RadioButton will reflect this decision. Similarly, when the user checks or unchecks the CheckBoxes or RadioButtons, the selection will reflect these actions.</p>
<p>Now, we just need to make sure our selection option on the ListBox reflects our interface choice. If you’re using CheckBoxes, make sure that your ListBox SelectionMode is set to “Multiple” or “Extended”. </p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image0011.png"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" border="0" alt="clip_image001[1]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip_image0011_thumb.png" width="251" height="93" /></a></p>
<p>If you’re using RadioButtons, it needs to be set to “Single”.</p>
<p>And you’re done! You can now set any ListBox to hold a list of checkable items simply by assigning it this ItemContainerStyle.</p>
<p><img src="http://www.designersilverlight.com/wp-content/uploads/2009/09/CheckBoxRadioButtonExample.png" alt="CheckBoxRadioButtonExample" title="CheckBoxRadioButtonExample" width="667" height="277" class="alignnone size-full wp-image-846" /></p>
<p>And you should have something that <a href="http://designersilverlight.com/SilverlightSamples/ListBoxCheckBox/">looks and acts like this</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/how-to-create-a-listbox-with-checkboxes-or-radiobuttons-in-silverlight-3/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How To Get a Silverlight 3 AutoCompleteBox To Show Sample Data in Blend 3</title>
		<link>http://blogs.veracitysolutions.com/how-to-get-a-silverlight-3-autocompletebox-to-show-sample-data-in-blend-3/</link>
		<comments>http://blogs.veracitysolutions.com/how-to-get-a-silverlight-3-autocompletebox-to-show-sample-data-in-blend-3/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 15:31:00 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Advanced Tutorial]]></category>
		<category><![CDATA[Blend]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[AutoCompleteBox]]></category>
		<category><![CDATA[Sample Data]]></category>
		<category><![CDATA[Silverlight 3]]></category>

		<guid isPermaLink="false">http://blogs.veracitysolutions.com/?p=610</guid>
		<description><![CDATA[Download Project Files for AutoCompleteBox Sample Data Project
So you’re playing around with Silverlight in Blend 3 and you set up some sample data. (If you don’t know how to do that, I’ll get to that in this tutorial too.) Your sample data is all set up and you’ve attached it to your AutoComplete box… but [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.designersilverlight.com/wp-content/uploads/2009/08/autocompleteboxsampledatatutorial.zip'>Download Project Files for AutoCompleteBox Sample Data Project</a></p>
<p>So you’re playing around with Silverlight in Blend 3 and you set up some sample data. (If you don’t know how to do that, I’ll get to that in this tutorial too.) Your sample data is all set up and you’ve attached it to your AutoComplete box… but nothing happens. You get angry and throw your computer out a window (unless it’s a MacBook, in which case you apologize to it for flirting with Microsoft technologies and take it for a little cuddle), but you eventually think you want to try again and so you go looking for the problem on the internet. Hopefully that is what brought you here.</p>
<p>I talk too much, I know.</p>
<p>Just to start out at the beginning, if you didn’t know that Silverlight 3 had an AutoCompleteBox, that’s because it isn’t a default control. You can install it and several other fantastic controls <a href="http://www.codeplex.com/Silverlight">via the Silverlight Toolkit</a>. If you don’t have this installed, do so now.</p>
<p>With the Silverlight Toolkit installed, let’s just make sure we have the right problem.</p>
<p>OK… lets create our sample data. In the top right corner of Blend, you’ll see a couple of tabs. Click on the “Data” tab and click on the “Add sample data” menu and choose “Define New Sample Data…”</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image001.png"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" border="0" alt="clip_image001" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image001-thumb.png" width="420" height="97" /></a></p>
<p>Name your database something short (you’ll see why later) and rename the “Collection” collection to something less confusing, like “Sample”. Add some string properties and give them handy names. You can see my sample data as a starting point…</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image00151.png"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" border="0" alt="clip_image001[5]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image0015-thumb1.png" width="234" height="118" /></a></p>
<p>That’ll do for now. Now, draw an AutoCompleteBox into your UserControl and drag the Sample collection on top of it. It will set itself to be the default ItemsSource. Now, hit F5 to run your application. It should act like this one below… if you type stuff, nothing comes up… but if you type “e”, you can see (in my sample, at least), it shows a set of items labeled, “Expression.Blend.SampleData.AutoData.SampleItem”.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image00114.png"><img style="border-bottom: 0px;border-left: 0px;border-top: 0px;border-right: 0px" border="0" alt="clip_image001[1]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image0011-thumb1.png" width="318" height="125" /></a></p>
<p>This is because the filter being used by default in the AutoCompleteBox takes the items and converts them directly to strings. If the item itself is an object (like this example and like most real data you’re probably using), it will convert it into the string representation of that data type.</p>
<p>So let’s fix it. First, we’re going to create an ItemTemplate for our AutoCompleteBox so that we can actually see the data in it. The quickest way to do this is actually kind of silly. Create a ListBox in your app and drag the data collection into it. It will auto-generate a super simple ItemTemplate. Then right-click on your AutoCompleteBox and go to “Edit Additional Templates –&gt; Edit ItemTemplate –&gt; Apply Resource –&gt; [name of generated template here]”</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image00171.png"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" border="0" alt="clip_image001[7]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image0017-thumb1.png" width="609" height="132" /></a></p>
<p>Delete your ListBox, just to clean things up.</p>
<p>Now you’ll have an AutoCompleteBox that shows the data like you want it, but it’s still looking at the “Expression.Blend.SampleData.SampleItem” when you type in the box, so it’s not acting the way we want. In order to do that, we just have to override the “ToString()” method in the AutoData. Open up “AutoData.xaml.cs” </p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image0011.png"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" border="0" alt="clip_image001[1]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image0011-thumb.png" width="234" height="150" /></a></p>
<p>Scroll down to the “SampleItem” class and make the beginning of that class look like this:</p>
<pre><span style="color: blue">public class </span><span style="color: #2b91af">SampleItem </span>: System.ComponentModel.<span style="color: #2b91af">INotifyPropertyChanged
</span>{
    <span style="color: blue">public override string </span>ToString()
    {
        <span style="color: blue">return </span>Name;
    }</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>If you want to use another property as your text return, just use that property name instead of Name. If you want to use a combination of properties, you could do something like this:</p>
<pre><span style="color: blue">return </span>Name + <span style="color: #a31515">&quot; - &quot; </span>+ CompanyName;</pre>
<p>Although, if you want it to look at two fields, you should change the FilterMode to “Contains”</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image0013.png"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" border="0" alt="clip_image001[3]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image0013-thumb.png" width="255" height="72" /></a></p>
<p>And… tada! You’re done… unless you want to give it some styling to better enhance the user experience (like putting the name at the top so that it draws the eye).</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image00131.png"><img style="border-bottom: 0px;border-left: 0px;border-top: 0px;border-right: 0px" border="0" alt="clip_image001[3]" src="http://www.designersilverlight.com/wp-content/uploads/2009/08/clip-image0013-thumb1.png" width="201" height="164" /></a></p>
<p>Also valuable, check out Tim Heuer’s post on turning <a href="https://timheuer.com/blog/archive/2008/11/05/silverlight-editable-combobox-using-styles.aspx">the AutoCompleteBox into an editable ComboBox</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/how-to-get-a-silverlight-3-autocompletebox-to-show-sample-data-in-blend-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How To Use a ListView or DataGrid In a ComboBox Drop Down (Without A Line Of Code)</title>
		<link>http://blogs.veracitysolutions.com/how-to-use-a-listview-or-datagrid-in-a-combobox-drop-down-without-a-line-of-code/</link>
		<comments>http://blogs.veracitysolutions.com/how-to-use-a-listview-or-datagrid-in-a-combobox-drop-down-without-a-line-of-code/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 00:30:00 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Combobox]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[ListView]]></category>
		<category><![CDATA[Styles]]></category>
		<category><![CDATA[Templates]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.designerwpf.com/2008/10/01/how-to-use-a-listview-or-datagrid-in-a-combobox-drop-down-without-a-line-of-code/</guid>
		<description><![CDATA[Super cool new thing I learned today. In WPF, we can make it so that the drop down (popup) on a ComboBox displays the data in a ListView. Because of the fact that I believe the DataGrid will eventually overtake the ListView as the gold standard for data display in WPF, we’ll do it both [...]]]></description>
			<content:encoded><![CDATA[<p>Super cool new thing I learned today. In WPF, we can make it so that the drop down (popup) on a ComboBox displays the data in a ListView. Because of the fact that I believe the DataGrid will eventually overtake the ListView as the gold standard for data display in WPF, we’ll do it both ways.</p>
<p>This tutorial is done entirely in Blend and without a line of code.</p>
<p><strong>Step 0)</strong> (for the DataGrid only)</p>
<p>Go to Code Plex and <a href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14963">download the WPF Toolkit</a>. Extract to a convenient location.</p>
<p>Right-Click on the References folder in your project tab and click “Add Reference…”</p>
<p><a href="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image001.png"><img src="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image001-thumb.png" title="clip_image001" style="border-width: 0px; display: inline" alt="clip_image001" border="0" height="85" width="238" /></a></p>
<p>Navigate to the location you extracted the WPFToolkit.dll file, select it and hit OK.<br />
<a href="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image0016.png"><img src="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image0016-thumb.png" title="clip_image001[6]" style="border-width: 0px; display: inline" alt="clip_image001[6]" border="0" height="205" width="177" /></a></p>
<p>Step 1) Select the ComboBox you wish to change and edit the ControlTemplate by right-clicking and selecting “Edit Control Parts (Template) –&gt; Edit a Copy…”</p>
<p><a href="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image0011.png"><img src="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image0011-thumb.png" title="clip_image001[1]" style="border: 0px none ; display: inline" alt="clip_image001[1]" border="0" height="55" width="328" /></a></p>
<p>Step 2) Find the ItemsPresenter. This is what would normally display our ItemsSource.</p>
<p><a href="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image0013.png"><img src="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image0013-thumb.png" title="clip_image001[3]" style="border: 0px none ; display: inline" alt="clip_image001[3]" border="0" height="187" width="252" /></a></p>
<p>We’re going to get rid of it. And the ScrollViewer for good measure.</p>
<p>Step 3) Where the ScrollViewer is, put in a ListView or a DataGrid, whichever one you’re using.</p>
<p><a href="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image0015.png"><img src="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image0015-thumb.png" title="clip_image001[5]" style="border: 0px none ; display: inline" alt="clip_image001[5]" border="0" height="132" width="255" /></a></p>
<p>Now, go the properties of that ListView or DataGrid and click on the box to the right of “ItemsSource”</p>
<p><a href="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image00111.png"><img src="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image00111-thumb.png" title="clip_image001[11]" style="border: 0px none ; display: inline" alt="clip_image001[11]" border="0" height="60" width="168" /></a></p>
<p>and, in the resulting menu, select “Template Binding –&gt; ItemsSource”.</p>
<p><a href="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image0017.png"><img src="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image0017-thumb.png" title="clip_image001[7]" style="border: 0px none ; display: inline" alt="clip_image001[7]" border="0" height="294" width="438" /></a></p>
<p>Set the DataContext of the ListView or DataGrid to the DataContext of the parent ComboBox using the same process.</p>
<p>And… you’re done! Open the ComboBox and you will see that you can select items in the ListView or DataGrid in the ComboBox dropdown and see those items change the selection of the ComboBox.</p>
<p><a href="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image00113.png"><img src="http://blogs.veracitysolutions.com/wp-content/uploads/2008/10/clip-image00113-thumb.png" title="clip_image001[13]" style="border: 0px none ; display: inline" alt="clip_image001[13]" border="0" height="193" width="545" /></a></p>
<p>You’ll notice that this is probably not yet an ideal solution. For example, when we select an item, the dropdown doesn’t automatically close. Your best bet is to use the SelectionChanged event to trigger some logic to close the ComboBox dropdown.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/how-to-use-a-listview-or-datagrid-in-a-combobox-drop-down-without-a-line-of-code/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Create a Zooming Button Style In Silverlight Without Code</title>
		<link>http://blogs.veracitysolutions.com/create-a-zooming-button-style-in-silverlight-without-code/</link>
		<comments>http://blogs.veracitysolutions.com/create-a-zooming-button-style-in-silverlight-without-code/#comments</comments>
		<pubDate>Fri, 19 Sep 2008 14:29:37 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[Helpful Links]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Styles]]></category>
		<category><![CDATA[Templates]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.designerwpf.com/2008/09/19/create-a-zooming-button-style-in-silverlight-without-code/</guid>
		<description><![CDATA[Download code for this sample
I was reading Mike Snow&#8217;s blog and he had a recent Silverlight tutorial on creating a Zooming toolbar. I looked at it and said to myself, &#8220;I think I can do that without code in Blend!&#8221; So here&#8217;s a tutorial on exactly that.
End product :

Big bonuses to this XAML-only method include:

Much [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.veracitysolutions.com/wp-content/uploads/2008/09/zoomingbtn.zip" title="(and here is the code by popular request)">Download code for this sample</a></p>
<p>I was reading Mike Snow&#8217;s blog and he had a recent <a href="http://silverlight.net/blogs/msnow/archive/2008/09/10/silverlight-tip-of-the-day-39-how-to-create-a-zoom-toolbar.aspx">Silverlight tutorial on creating a Zooming toolbar</a>. I looked at it and said to myself, &#8220;I think I can do that without code in Blend!&#8221; So here&#8217;s a tutorial on exactly that.</p>
<p>End product :</p>
<p><iframe scrolling="no" frameBorder="0" src="http://silverlight.services.live.com/invoke/77530/ZoomToolbar2/iframe.html" style="width: 432px; height: 392px"></iframe></p>
<p>Big bonuses to this XAML-only method include:</p>
<ul>
<li>Much smoother animation</li>
<li>Midway animation (if you fly over a button, it doesn&#8217;t need to animate all the way up before it starts to animate back down)</li>
<li>Really low overhead</li>
<li>Can be done and maintained entirely by a designer in Blend without any code</li>
</ul>
<p>1) create a new Silverlight project in either Visual Studio 2008 or Blend 2.5.</p>
<p>2) In Blend, add a new folder for our images by right-clicking on the project and selecting &#8220;Add New Folder&#8221;</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image001.png"><img border="0" width="207" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image001-thumb.png" alt="clip_image001" height="72" style="border-width: 0px" /></a></p>
<p>3) Pull in our images by right-clicking on our new folder and selecting &#8220;Add Existing Item&#8230;&#8221; Navigate to the images you want to use and select &#8220;OK&#8221; to bring them into the project.</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image0014.png"><img border="0" width="273" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image0014-thumb.png" alt="clip_image001[4]" height="63" style="border-width: 0px" /></a></p>
<p>4) Create the button to which you want to add the image and then double-click it in the Obejcts and Timeline pane so that it has a yellow outline around it.</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image0016.png"><img border="0" width="314" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image0016-thumb.png" alt="clip_image001[6]" height="180" style="border-width: 0px" /></a></p>
<p>5) Now, go to the image you want to insert (in the Project panel), right click on it and select &#8220;Insert&#8221;</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image0018.png"><img border="0" width="317" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image0018-thumb.png" alt="clip_image001[8]" height="188" style="border-width: 0px" /></a></p>
<p>OK&#8230; so now we have a button with an image in it. Now it&#8217;s time to make the sucker zoom.</p>
<p>6) Right click on the button and select &#8220;Edit Control Parts (Template) -&gt; Edit a Copy&#8230;&#8221;</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00110.png"><img border="0" width="338" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00110-thumb.png" alt="clip_image001[10]" height="86" style="border-width: 0px" /></a></p>
<p>Name your custom Template and hit OK</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00112.png"><img border="0" width="382" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00112-thumb.png" alt="clip_image001[12]" height="88" style="border-width: 0px" /></a></p>
<p>7) In the &#8220;States&#8221; pane, you see a set of &#8220;CommonStates&#8221; (Normal, MouseOver, Pressed, and Disabled). Click on the MouseOver state and a red box will surround your composition, indicating that any changes made will be changes to the &#8220;Mouse Over&#8221; state, not to the default control.</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00114.png"><img border="0" width="255" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00114-thumb.png" alt="clip_image001[14]" height="156" style="border-width: 0px" /></a></p>
<p>Recording state:</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00116.png"><img border="0" width="160" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00116-thumb.png" alt="clip_image001[16]" height="40" style="border-width: 0px" /></a></p>
<p>8] Click on the highest level item in the template (in my case, it is a &#8220;Grid&#8221;) and go to the &#8220;Transform&#8221; section in the &#8220;Properties&#8221; pane and select the &#8220;Scale&#8221; transformation tab. Change the X and Y scales to &#8220;1.5&#8243;</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00118.png"><img border="0" width="281" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00118-thumb.png" alt="clip_image001[18]" height="309" style="border-width: 0px" /></a></p>
<p>If you run the project now, you&#8217;ll notice that we get a cool zoom in effect on the mouse over, but our zoom out when the mouse leaves the button is basically a snap back to the original size. Let&#8217;s fix that now.</p>
<p>9) Click on the the arrow icon in the MouseOver state in the States pane and select the &#8220;MouseOver -&gt; Normal&#8221;</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00120.png"><img border="0" width="380" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00120-thumb.png" alt="clip_image001[20]" height="109" style="border-width: 0px" /></a></p>
<p>In the &#8220;Transition Duration&#8221; box, type &#8220;.2&#8243;</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00124.png"><img border="0" width="243" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00124-thumb.png" alt="clip_image001[24]" height="74" style="border-width: 0px" /></a></p>
<p>10) Extra Designer Happiness Bonus Step! &#8211; If you&#8217;d like to have a zoom effect that isn&#8217;t strictly linear, open up the timeline view with the button on the right hand of the state recording box (seen below).</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00126.png"><img border="0" width="255" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00126-thumb.png" alt="clip_image001[26]" height="54" style="border-width: 0px" /></a></p>
<p>Click and drag the keyframe (the light gray oval below) to the point you want it. I put mine at .3 seconds.</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00128.png"><img border="0" width="276" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00128-thumb.png" alt="clip_image001[28]" height="136" style="border-width: 0px" /></a></p>
<p>With the keyframe selected, you should see an &#8220;Easing&#8221; pane on the right. The default easing is linear (aka. no easing), but you can change the easing curve by just dragging the yellow dots. Here is the easing curve I&#8217;ve found works pretty well for my apps.</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00130.png"><img border="0" width="282" src="http://www.designerwpf.com/wp-content/uploads/2008/09/clip-image00130-thumb.png" alt="clip_image001[30]" height="326" style="border-width: 0px" /></a></p>
<p>That&#8217;s it. Now you can just assign this template to a button and you&#8217;ll have this zooming functionality all set up.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/create-a-zooming-button-style-in-silverlight-without-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Assign ColumnHeaderContainerStyle and ColumnHeaderTemplate to a ListView Style</title>
		<link>http://blogs.veracitysolutions.com/how-to-assign-columnheadercontainerstyle-and-columnheadertemplate-to-a-listview-style/</link>
		<comments>http://blogs.veracitysolutions.com/how-to-assign-columnheadercontainerstyle-and-columnheadertemplate-to-a-listview-style/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 23:06:06 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[How To...]]></category>
		<category><![CDATA[ListView]]></category>
		<category><![CDATA[Styles]]></category>
		<category><![CDATA[Templates]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>
		<category><![CDATA[columnheadercontainerstyle]]></category>
		<category><![CDATA[columnheadertemplate]]></category>
		<category><![CDATA[GridView]]></category>
		<category><![CDATA[style]]></category>

		<guid isPermaLink="false">http://www.designerwpf.com/2008/08/15/how-to-assign-columnheadercontainerstyle-and-columnheadertemplate-to-a-listview-style/</guid>
		<description><![CDATA[This is just a quick note on creating a ListView style with the appropriate GridView style and template assignments.
Normally, I&#8217;ve been creating listviews that look like this:


&#60;ListView x:Name=&#8221;MyListView&#8221;
               ItemContainerStyle=&#8221;{DynamicResource MyListViewItemContainerStyle}&#8221;&#62;
    &#60;ListView.View&#62;
         &#60;GridView ColumnHeaderContainerStyle=&#8221;{DynamicResource MyListViewHeaderStyle}&#8221;
                         ColumnHeaderTemplate=&#8221;{DynamicResource MyGridColumnHeaderTemplate}&#8221;&#62; 
I did this because I didn&#8217;t know exactly how to assign these styles and templates to the ListView Style. In [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick note on creating a ListView style with the appropriate GridView style and template assignments.</p>
<p>Normally, I&#8217;ve been creating listviews that look like this:</p>
<blockquote>
<pre class="code"><span style="color: blue"></span></pre>
<p><span style="color: blue">&lt;</span><span style="color: #a31515">ListView </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&#8221;MyListView&#8221;</span><span style="color: red"><br />
               ItemContainerStyle</span><span style="color: blue">=&#8221;{</span><span style="color: #a31515">DynamicResource </span><span style="color: red">MyListViewItemContainerStyle</span><span style="color: blue">}&#8221;&gt;<br />
    </span><span style="color: blue">&lt;</span><span style="color: #a31515">ListView.View</span><span style="color: blue">&gt;<br />
         </span><span style="color: blue"><span style="color: blue">&lt;</span><span style="color: #a31515">GridView </span><span style="color: red">ColumnHeaderContainerStyle</span><span style="color: blue">=&#8221;{</span><span style="color: #a31515">DynamicResource </span><span style="color: red">MyListViewHeaderStyle</span><span style="color: blue">}&#8221;<br />
                         </span></span><span style="color: blue"><span style="color: red">ColumnHeaderTemplate</span><span style="color: blue">=&#8221;{</span><span style="color: #a31515">DynamicResource </span><span style="color: red">MyGridColumnHeaderTemplate</span><span style="color: blue">}&#8221;&gt;</span></span><span style="color: blue"> </span></p></blockquote>
<p><span style="color: blue"><font color="#000000">I did this because I didn&#8217;t know exactly how to assign these styles and templates to the ListView Style. In the style, ColumnHeaderContainerStyle and ColumnHeaderTemplate are not properties of the ListView, they are properties of the GridView&#8230; which you can&#8217;t create a style for.</font></span></p>
<p><span style="color: blue"><font color="#000000">Instead, you can encapsulate all the information above in the following style.</font></span></p>
<blockquote><p><span style="color: blue">&lt;</span><span style="color: #a31515">Style </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Key</span><span style="color: blue">=&#8221;CustomListViewStyle&#8221; </span><span style="color: red">TargetType</span><span style="color: blue">=&#8221;{</span><span style="color: #a31515">x</span><span style="color: blue">:</span><span style="color: #a31515">Type </span><span style="color: red">ListView</span><span style="color: blue">}&#8221;&gt;<br />
      &lt;</span><span style="color: #a31515">Setter </span><span style="color: red">Property</span><span style="color: blue">=&#8221;GridView.ColumnHeaderContainerStyle&#8221; </span><span style="color: red">Value</span><span style="color: blue">=&#8221;{</span><span style="color: #a31515">DynamicResource </span><span style="color: red">MyListViewHeaderStyle</span><span style="color: blue">}&#8221; /&gt;<br />
      </span><span style="color: blue">&lt;</span><span style="color: #a31515">Setter </span><span style="color: red">Property</span><span style="color: blue">=&#8221;GridView.ColumnHeaderTemplate&#8221; </span><span style="color: red">Value</span><span style="color: blue">=&#8221;{</span><span style="color: #a31515">DynamicResource </span><span style="color: red">MyGridColumnHeaderTemplate</span><span style="color: blue">}&#8221; /&gt;<br />
      </span><span style="color: blue">&lt;</span><span style="color: #a31515">Setter </span><span style="color: red">Property</span><span style="color: blue">=&#8221;ItemContainerStyle&#8221; </span><span style="color: red">Value</span><span style="color: blue">=&#8221;{</span><span style="color: #a31515">DynamicResource </span><span style="color: red">MyListViewItemContainerStyle</span><span style="color: blue">}&#8221; /&gt;<br />
<span style="color: blue">&lt;/</span><span style="color: #a31515">Style&gt;</span></span></p></blockquote>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><span style="color: blue"><font color="#000000">Problem solved.</font></span></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/how-to-assign-columnheadercontainerstyle-and-columnheadertemplate-to-a-listview-style/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Styling the ScrollViewer</title>
		<link>http://blogs.veracitysolutions.com/styling-the-scrollviewer/</link>
		<comments>http://blogs.veracitysolutions.com/styling-the-scrollviewer/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 23:43:26 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[ScrollViewer]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[WPF Designer Guides]]></category>

		<guid isPermaLink="false">http://www.designerwpf.com/2008/08/07/styling-the-scrollviewer/</guid>
		<description><![CDATA[I recently got a comment asking if I could do something on creating a Blend-type ScollViewer styling. The only problem is that the ScrollViewer is a multi-post affair, which I&#8217;ll try to get completed in the next month or so. I&#8217;m going to go ahead and put up the basics here, much like my Styling [...]]]></description>
			<content:encoded><![CDATA[<p>I recently got a comment asking if I could do something on creating a Blend-type ScollViewer styling. The only problem is that the ScrollViewer is a multi-post affair, which I&#8217;ll try to get completed in the next month or so. I&#8217;m going to go ahead and put up the basics here, much like my <a href="http://www.designerwpf.com/2008/02/07/the-wpf-designers-guide-to-styling-the-combobox/">Styling the ComboBox</a> and <a href="http://www.designerwpf.com/2007/12/06/the-wpf-designers-guide-to-styling-the-your-favorite-adjectival-swear-word-here-listview/">Styling the ListView</a> posts.</p>
<p>In the meantime, I&#8217;m making available for download a <a href="http://www.designerwpf.com/wp-content/uploads/2008/08/blendscrolldictionary.xaml">Resource Dictionary with the Blend ScrollViewer</a> style as I&#8217;ve approximated it. (You may have to right-click &#8220;Save As&#8230;&#8221; on that file since IE will do its darndest to open it up.) Just load the resource dictionary into your project and set</p>
<p><span style="color: blue">&lt;</span><span style="color: #a31515">ScrollViewer </span><span style="color: red">Template</span><span style="color: blue">=&#8221;{</span><span style="color: #a31515">DynamicResource </span><span style="color: red">BlendScrollTemplate</span><span style="color: blue">}&#8221; /&gt;</span></p>
<p>Note: This is not the &#8220;real&#8221; Blend styles&#8230; just my rendition/approximation.</p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>In the meantime, here&#8217;s the overview for the ScrollViewer. When you look at a template of the ScrollViewer (right-click on the ScrollViewer, got to &#8220;<strong>Edit Control Parts (Template) -&gt; Edit a Copy&#8230;</strong>&#8220;) you should see something like this:</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image0017.png"><img src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image0017-thumb.png" style="border: 0px none " alt="clip_image001[7]" width="255" border="0" height="172" /></a></p>
<p>If you want to change something about the main content area (highlighted below), you&#8217;re probably going after the <strong>PART_ScrollContentPresenter</strong></p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00111.png"><img src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00111-thumb.png" style="border: 0px none " alt="clip_image001[11]" width="259" border="0" height="146" /></a></p>
<p>If you want to style the corner (highlighted below), look at changing the <strong>Corner Rectangle</strong>.</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00115.png"><img src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00115-thumb.png" style="border: 0px none " alt="clip_image001[15]" width="260" border="0" height="144" /></a></p>
<p>If you want to style the <strong>HorizontalScrollBar</strong> and/or the <strong>VerticalScrollBar</strong> (highlighted below), you should right-click on either the <strong>PART_VerticalScrollBar</strong> or the <strong>PART_HorizontalScrollBar</strong> and go to &#8220;<strong>Edit Control Parts (Template) -&gt; Edit a Copy&#8230;</strong>&#8221;</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00113.png"><img src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00113-thumb.png" style="border: 0px none " alt="clip_image001[13]" width="262" border="0" height="146" /></a></p>
<p>A point of note: Because of the way Blend works, it can be difficult to visually style a Vertical and Horizontal ScrollBar in the same Template. Don&#8217;t create another template. It&#8217;s a waste of time and will make your resources a pain to navigate. I&#8217;ll go over exactly what to do in a little bit.</p>
<p>The ScrollBar template should look something like this:</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image0019.png"><img src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image0019-thumb.png" style="border: 0px none " alt="clip_image001[9]" width="252" border="0" height="231" /></a></p>
<p>If you want to style the <strong>ScrollBar thumbs</strong> (the bars you would drag to scroll, highlighted below), you&#8217;ll need to change the template for the &#8220;<strong>Thumb</strong>&#8221; in the <strong>PART_Track</strong>. Note: Unless you&#8217;re doing something really complex, you should only need to style the Thumb control one time. You don&#8217;t need different styles for the vertical and the horizontal.</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00117.png"><img src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00117-thumb.png" style="border: 0px none " alt="clip_image001[17]" width="258" border="0" height="144" /></a></p>
<p>If you want to style the directional buttons (highlighted below), you will need to change the templates for the first and last &#8220;<strong>RepeatButton</strong>&#8221; controls (the ones that aren&#8217;t in the PART_Track) using the <strong>right-click -&gt; Edit Control Parts (Template) -&gt; Edit Template</strong>. (This template should already be copied into your resources.) Again, unless you&#8217;re doing something complex, you should only need to style this button one time.</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00119.png"><img src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00119-thumb.png" style="border: 0px none " alt="clip_image001[19]" width="258" border="0" height="148" /></a></p>
<p>If you want to style the empty area that allows for fast scrolling, you will need to change the style for the two RepeatButtons in the <strong>PART_Track</strong> (<strong>DecreaseRepeatButton</strong> and <strong>IncreaseRepeatButton</strong>)using the <strong>right-click -&gt; Edit Control Parts (Template) -&gt; Edit Template</strong>. You should only need to do this one time and then apply that style/template across the all the instances of this button.</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00121-thumb.png" style="border: 0px none " alt="clip_image001[21]" width="258" border="0" height="144" /></p>
<p>Over the next couple weeks, I&#8217;ll try to put up posts going over how to style all of these into the Blend style. I&#8217;ll update this post pointing to the more in-depth tutorials as I go along. Until I get around to doing that, feel free to download the <a href="http://www.designerwpf.com/wp-content/uploads/2008/08/blendscrolldictionary.xaml">ResourceDictionary with the Blend styles</a> in them.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/styling-the-scrollviewer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
