<?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; Blend</title>
	<atom:link href="http://blogs.veracitysolutions.com/category/blend/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>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>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>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>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>
		<item>
		<title>Head First C#: Silverlight Supplement For Chapter 1 (pages 8-16)</title>
		<link>http://blogs.veracitysolutions.com/head-first-c-silverlight-supplement-for-chapter-1-pages-8-16/</link>
		<comments>http://blogs.veracitysolutions.com/head-first-c-silverlight-supplement-for-chapter-1-pages-8-16/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 17:45:25 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[Head First Supplement]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[HtmlPage]]></category>
		<category><![CDATA[MessageBox]]></category>
		<category><![CDATA[Silverlight 2]]></category>

		<guid isPermaLink="false">http://www.designerwpf.com/2008/08/06/head-first-c-silverlight-supplement-for-chapter-1-pages-8-16/</guid>
		<description><![CDATA[Silverlight Concepts Covered:

Building a basic Silverlight project
Creating code behind for a event triggered by the user
Creating an HTML alert (a fake MessageBox) in Silverlight

Project Files are available for download at the bottom of the page.
Because I&#8217;m an interaction designer and not a coder, I find that there are certain things that can be very limiting [...]]]></description>
			<content:encoded><![CDATA[<h3>Silverlight Concepts Covered:</h3>
<ul>
<li>Building a basic Silverlight project</li>
<li>Creating code behind for a event triggered by the user</li>
<li>Creating an HTML alert (a fake MessageBox) in Silverlight</li>
</ul>
<p>Project Files are available for download at the bottom of the page.</p>
<p>Because I&#8217;m an interaction designer and not a coder, I find that there are certain things that can be very limiting for me. I&#8217;ve decided to fix that by learning how to code properly. To do so, I&#8217;m using a book that actually makes sense to me: <a href="http://www.amazon.com/Head-First-C-Brain-Friendly-Guides/dp/0596514824/ref=pd_bbs_sr_2?ie=UTF8&amp;s=books&amp;qid=1218036644&amp;sr=8-2">Head First C#.</a> If you&#8217;ve never used the Head First series, its generally a pretty good series zero-to-sixty book on the given topic which teaches by doing (the only way I&#8217;ve found I can learn anything).</p>
<p>Sadly, Head First C# currently uses WinForms for all user interfaces. This is the beginning of a series in which I&#8217;ll go through the book, but replace all the WinForms with Silverlight. I will very purposely not give the rest of the lessons because I have a nagging moral qualm in the back of my mind about taking someone else&#8217;s intellectual property and putting it up on my blog. Call me old fashioned.</p>
<p>I will, however, be going through the project and offering alternative code downloads of the projects (with Silverlight interfaces). I figure that, because the Heads First books allow <a href="http://www.headfirstlabs.com/books/hfcsharp/">free downloads of their project code</a> on their website, they don&#8217;t mind me doing this on mine. If anyone from O&#8217;Reilly is reading this and disagrees, just let me know.</p>
<p>The first chapter has you building a program for entering and saving Contacts from start to finish. I will be pointing to the pages and listing alternative Silverlight steps</p>
<h3>Pages 8-16</h3>
<p>1. Start Visual Studio 2008 and select &#8220;Silverlight Application&#8221; from your list of options. The default &#8220;Web Page&#8221; options should be fine for what we&#8217;re doing.</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image0011.png"></a></p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image0011.png"><img border="0" width="697" src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image001-thumb.png" alt="clip_image001" height="265" style="border: 0px" /></a></p>
<p>2. Open up Expression Blend 2.5 (I&#8217;m using the June 2008 Preview) and find your project and open it.</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00112.png"><img border="0" width="306" src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00112-thumb.png" alt="clip_image001[12]" height="171" style="border: 0px" /></a></p>
<p>3. Double Click on the Page.xaml file to open it up in Blend. We&#8217;re going to create the basics of our user interface here.</p>
<p>4. Go ahead and grab the &#8220;Objectville Paper Co&#8221; image from <a href="http://www.headfirstlabs.com/books/hfcsharp/">the Heads First web site</a>. Right click on your project in Blend and select &#8220;Add New Folder&#8221;. Name your new folder &#8220;Images&#8221;. Right click on that folder, click &#8220;Add Existing Item&#8230;&#8221; and navigate the graphic you downloaded. Your project should look something like this:</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00114.png"><img border="0" width="293" src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00114-thumb.png" alt="clip_image001[14]" height="398" style="border: 0px" /></a></p>
<p>5. Drag the image from the project to the canvas. Things may look a little crowded on the canvas, so lets make it a little bigger. Click the &#8220;<strong>Properties</strong>&#8221; tab (a) on the right side of Blend and make sure you have <strong>UserControl</strong> (the highest object in the tree) selected in the &#8220;<strong>Objects and Timeline</strong>&#8221; (on the left side) (b). Change the <strong>Width</strong> to <strong>600</strong> and the <strong>Height</strong> to<strong> 800</strong> (c).</p>
<p>(a)</p>
<p><img border="0" width="294" src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00116-thumb.png" alt="clip_image001[16]" height="37" style="border: 0px" /></p>
<p>(b)</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00118.png"><img border="0" width="322" src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00118-thumb.png" alt="clip_image001[18]" height="157" style="border: 0px" /></a></p>
<p>(c)</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00120.png"><img border="0" width="282" src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00120-thumb.png" alt="clip_image001[20]" height="75" style="border: 0px" /></a></p>
<p>6. You&#8217;ll probably notice that our images got stretched. We&#8217;re going to follow the spirit of HFC# and change it to be an unstretched size. Select the <strong>Image</strong> from your <strong>Objects and Timeline</strong> and set <strong>Stretch </strong>to <strong>None</strong>, <strong>HorizontalAlignment</strong> to <strong>Left </strong>and <strong>VerticalAlignment</strong> to <strong>Right</strong>.</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00122.png"><img border="0" width="283" src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00122-thumb.png" alt="clip_image001[22]" height="160" style="border: 0px" /></a></p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00124.png"><img border="0" width="274" src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00124-thumb.png" alt="clip_image001[24]" height="60" style="border: 0px" /></a></p>
<p>7. Before we run the project, let&#8217;s change the background so we can tell where our page is. Select the <strong>LayoutRoot</strong> and change the <strong>Background</strong> to something not white (I chose a light blue). Save All in Blend and click on your open Visual Studio 2008 and hit <strong>F5</strong>. (I haven&#8217;t had a lot of luck getting Silverlight projects to run from Blend)</p>
<p>OK, that gets us to page 14. The next step is to add extra code to the auto-generated code in Visual Studio.</p>
<p>8. Go back to Blend and click on the <strong>Image</strong> and go to the <strong>Events</strong> section (the little lighting icon) of the <strong>Properties</strong> tab. This will give you a list of all the events available for the Image control.</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00126.png"><img border="0" width="295" src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00126-thumb.png" alt="clip_image001[26]" height="96" style="border: 0px" /></a></p>
<p>9. In <strong>MouseLeftButtonUp</strong>, type the name of the method you want called when the Image registers a MouseLeftButtonUp event (I typed ImageClick) and hit enter.</p>
<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00128.png"><img border="0" width="277" src="http://www.designerwpf.com/wp-content/uploads/2008/08/clip-image00128-thumb.png" alt="clip_image001[28]" height="33" style="border: 0px" /></a></p>
<p>10. Blend will communicate to Visual Studio, which will in turn auto-generate all the code you need for that event handler. It should look something like this:</p>
<blockquote><p><span style="color: blue">private void </span>ImageClick(<span style="color: blue">object </span>sender, <span style="color: #2b91af">MouseButtonEventArgs </span>e)</p>
<p>{</p>
<p>}</p></blockquote>
<p>11. Type the following at the top of the page:</p>
<blockquote><p><span style="color: blue">using </span>System.Windows.Browser;</p></blockquote>
<p>and then type the following into the ImageClick method:</p>
<blockquote><p><span style="color: #2b91af">HtmlPage</span>.Window.Alert(<span style="color: #a31515">&#8220;Contact List 1.0. \nWritten by: Your Name&#8221;</span>);</p></blockquote>
<p>Run your project.</p>
<p>From here, HFC# walks through creating a database. The next installment will pick up after the database is created and we get to bind the data to our interface.</p>
<p>Download Project Files for this post: <a href="http://www.designerwpf.com/wp-content/uploads/2008/08/headsfirstchaper1_part1.zip" title="HFCSharp Part 1 Project Files">HFCSharp Part 1 Project Files</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/head-first-c-silverlight-supplement-for-chapter-1-pages-8-16/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Do I Make a ListView or a ScrollViewer Left Handed?</title>
		<link>http://blogs.veracitysolutions.com/how-do-i-make-a-listview-or-a-scrollviewer-left-handed/</link>
		<comments>http://blogs.veracitysolutions.com/how-do-i-make-a-listview-or-a-scrollviewer-left-handed/#comments</comments>
		<pubDate>Sat, 19 Apr 2008 05:40:32 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[ListView]]></category>
		<category><![CDATA[ScrollViewer]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>
		<category><![CDATA[left handed]]></category>
		<category><![CDATA[lefty]]></category>
		<category><![CDATA[scrollbar]]></category>
		<category><![CDATA[Triggers]]></category>

		<guid isPermaLink="false">http://www.designerwpf.com/2008/04/18/how-do-i-make-a-listview-or-a-scrollviewer-left-handed/</guid>
		<description><![CDATA[Several months back, I was doing some work for a company that was using WPF for a stylus based application. One of the things that they found they needed was a scrollbar that could be used by left handed people who would have to cover the entire screen with their left hand in order to [...]]]></description>
			<content:encoded><![CDATA[<p>Several months back, I was doing some work for a company that was using WPF for a stylus based application. One of the things that they found they needed was a scrollbar that could be used by left handed people who would have to cover the entire screen with their left hand in order to scroll a traditional scroll viewer.</p>
<p>The solution ended up being so easy in WPF that I thought I&#8217;d post it here.</p>
<p>I&#8217;m in a two-birds-one-stone mood, so we&#8217;ll do this for both the listview, which will also cover a more traditional scrollviewer. Let&#8217;s start with our ever friendly listview.</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/04/normallistview.png" alt="NormalListView" />At the very sight of this thing, with a stylus in hand, your average lefty is thinking to him or herself &#8220;I wonder if I can do my work upside down?&#8221; Let&#8217;s show them that we love and accept them just as they are.</p>
<p>The first thing we&#8217;re going to do is create a new template for this sucker, so right click on your listview and go to &#8220;<strong>Edit Control Parts (Template) -&gt; Edit a Copy…</strong>&#8221;</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/04/lefty_editcontrolparts.png" alt="Lefty_EditControlParts" /></p>
<p>Now we&#8217;re looking at the standard listview template. Mine looks like this:</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/04/lefty_listviewtemplate.png" alt="ListViewTemplate" />Let&#8217;s dig right into the ScrollViewer. If you&#8217;re doing this from the listview (like I am) then creating a template for the listview has already created a template for the scrollviewer. If you&#8217;re starting from a basic scrollviewer, you can pretty much start right here.</p>
<p>For the purposes of making this thing easy to work with in Blend, go ahead and set the HorizontalScrollBarVisibility and VerticalScrollBarVisibility to Visible.</p>
<p> <img src="http://www.designerwpf.com/wp-content/uploads/2008/04/scrollbarvisibiltiy.png" alt="ScrollBar_Visibility" /></p>
<p>And then &#8220;<strong>Edit Control Parts (Template) -&gt; Edit a Copy…</strong>&#8221; (or &#8220;<strong>Edit Control Parts (Template) -&gt; Edit Template</strong>&#8221; if it is available).</p>
<p>We are now looking at the guts of the ScrollViewer Control.</p>
<p>ListView ScrollViewer will look like this:</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/04/listviewscrolltemplate.png" alt="ListViewScrollTemplate" />The normal ScrollViewer will look like this:</p>
<p> <img src="http://www.designerwpf.com/wp-content/uploads/2008/04/lefty_normalscrollviewer.png" alt="NormalScrollViewer" /></p>
<p>For our purposes, they&#8217;re functionally the same. It is actually a fairly simple control… basically just a Grid panel with the columns and rows set up like so:</p>
<p><font color="#0000ff">&lt;</font><font color="#800000">Grid.ColumnDefinitions</font><font color="#0000ff">&gt;</font><br />
<font color="#0000ff">      &lt;</font><font color="#800000">ColumnDefinition</font> <font color="#ff0000">Width</font>=&#8221;<font color="#0000ff">*</font>&#8220;<font color="#0000ff">/&gt;</font><br />
<font color="#0000ff">      &lt;</font><font color="#800000">ColumnDefinition</font> <font color="#ff0000">Width</font>=&#8221;<font color="#0000ff">Auto</font>&#8220;<font color="#0000ff">/&gt;</font><br />
<font color="#0000ff">&lt;/</font><font color="#800000">Grid.ColumnDefinitions</font><font color="#0000ff">&gt;</font></p>
<p><font color="#0000ff">&lt;</font><font color="#800000">Grid.RowDefinitions</font><font color="#0000ff">&gt;</font><br />
<font color="#0000ff">      &lt;</font><font color="#800000">RowDefinition</font> <font color="#ff0000">Height</font>=&#8221;<font color="#0000ff">*</font>&#8220;<font color="#0000ff">/&gt;</font><br />
<font color="#0000ff">      &lt;</font><font color="#800000">RowDefinition</font> <font color="#ff0000">Height</font>=&#8221;<font color="#0000ff">Auto</font>&#8220;<font color="#0000ff">/&gt;</font><br />
<font color="#0000ff">&lt;/</font><font color="#800000">Grid.RowDefinitions</font><font color="#0000ff">&gt;</font></p>
<p>The scrollBars are set up so that their visibility is tied to (duh) the visibility that is set on the control. But what this does is it means that when they are collapsed… they Grid reclaims the space that they were taking up.</p>
<p>Now… here&#8217;s the hilarious part… in order to make this ScrollViewer left handed, all you have to do is swap the Grid.Columns:</p>
<p><font color="#0000ff">&lt;</font><font color="#800000">Grid.ColumnDefinitions</font><font color="#0000ff">&gt;</font><br />
<font color="#0000ff">      &lt;</font><font color="#800000">ColumnDefinition</font> <font color="#ff0000">Width</font>=&#8221;<font color="#0000ff">Auto</font>&#8220;<font color="#0000ff">/&gt;</font><br />
<font color="#0000ff">      &lt;</font><font color="#800000">ColumnDefinition</font> <font color="#ff0000">Width</font>=&#8221;<font color="#0000ff">*</font>&#8220;<font color="#0000ff">/&gt;</font><br />
<font color="#0000ff">&lt;/</font><font color="#800000">Grid.ColumnDefinitions</font><font color="#0000ff">&gt;</font></p>
<p>You&#8217;ve now switched the columns so that the left handed column is auto. Here&#8217;s a list of the Grid.Column realignments you&#8217;ll need to make:</p>
<p><strong>Change Column to &#8220;1&#8243;:</strong></p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/04/lefty_columnswitch1.png" alt="Lefty_Column1" /></p>
<ul>
<li>PART_HorizontalScrollBar</li>
<li>All DockPanels (ListView only)</li>
<li>PART_ScrollContentPresenter (ScrollViewer only)</li>
<li>Corner (ScrollViewer only)</li>
</ul>
<p><strong>Change Column to &#8220;0&#8243;:</strong></p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/04/lefty_columnswitch0.png" alt="Lefty_Column0" /></p>
<ul>
<li>PART_VerticalScrollBar</li>
</ul>
<p>Basically, swap everything from in the two columns.</p>
<p>Done.</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/04/finalleftyproduct.png" alt="FinalLeftyListView" />If you want to make this a more robust control, I recommend creating a ScrollViewer with an additional dependency property (IsSouthPaw or something). Make it so that your Grid has three columns:</p>
<p><font color="#0000ff">&lt;</font><font color="#800000">Grid.ColumnDefinitions</font><font color="#0000ff">&gt;</font><br />
<font color="#0000ff">      &lt;</font><font color="#800000">ColumnDefinition</font> <font color="#ff0000">Width</font>=&#8221;<font color="#0000ff">Auto</font>&#8220;<font color="#0000ff">/&gt;</font><br />
<font color="#0000ff">      &lt;</font><font color="#800000">ColumnDefinition</font> <font color="#ff0000">Width</font>=&#8221;<font color="#0000ff">*</font>&#8220;<font color="#0000ff">/&gt;<br />
      &lt;<font color="#800000">ColumnDefinition</font><font color="#000000"> </font><font color="#ff0000">Width</font><font color="#000000">=&#8221;</font><font color="#0000ff">Auto</font><font color="#000000">&#8220;</font><font color="#0000ff">/&gt;</font></font><br />
<font color="#0000ff">&lt;/</font><font color="#800000">Grid.ColumnDefinitions</font><font color="#0000ff">&gt;</font></p>
<p>And then you can just create a trigger that swaps the column placement of your PART_VerticalScrollBar. Such a trigger will look something like this. And by &#8220;something&#8221;, I mean &#8220;exactly&#8221;.</p>
<p><font color="#0000ff">&lt;</font><font color="#800000">Trigger</font> <font color="#ff0000">Property</font>=&#8221;<font color="#0000ff">IsSouthPaw</font>&#8221; <font color="#ff0000">Value</font>=&#8221;<font color="#0000ff">True</font>&#8220;<font color="#0000ff">&gt;</font><br />
      <font color="#0000ff">&lt;</font><font color="#800000">Setter</font> <font color="#ff0000">Property</font>=&#8221;<font color="#0000ff">Grid.Column</font>&#8221; <font color="#ff0000">TargetName</font>=&#8221;<font color="#0000ff">PART_VerticalScrollBar</font>&#8220;  <font color="#ff0000">Value</font>=&#8221;<font color="#0000ff">0</font>&#8221; <font color="#0000ff">/&gt;</font><br />
<font color="#0000ff">&lt;/</font><font color="#800000">Trigger</font><font color="#0000ff">&gt;</font></p>
<p>Go forth and make Ned Flanders proud.</p>
<p>By the way, I listen to pop punk whenever I write my tutorials and I just thought I should let <a href="http://en.wikipedia.org/wiki/Senses_Fail">Senses Fail </a>know that they can probably get away with about 80% less &#8220;dying cat&#8221; screaming and still put out good music. You know&#8230; because they&#8217;re probably WPF programmers on the side and they&#8217;ll probably read this to solve all their left-handed scrollbar needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/how-do-i-make-a-listview-or-a-scrollviewer-left-handed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Styling the ComboBox Dropdown (popup)</title>
		<link>http://blogs.veracitysolutions.com/styling-the-combobox-dropdown-popup/</link>
		<comments>http://blogs.veracitysolutions.com/styling-the-combobox-dropdown-popup/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 03:36:25 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[Combobox]]></category>
		<category><![CDATA[cornerradius]]></category>
		<category><![CDATA[dropdown]]></category>
		<category><![CDATA[padding]]></category>
		<category><![CDATA[Popup]]></category>

		<guid isPermaLink="false">http://www.designerwpf.com/2008/03/24/styling-the-combobox-dropdown-popup/</guid>
		<description><![CDATA[ This tutorial derives from the general &#8220;How to Style the ComboBox&#8221; set of tutorials.
First let&#8217;s make sure you&#8217;re in the right place. In this tutorial, we&#8217;re going to style the comboBox drop down (also known as the ComboBox popup) seen highlighted in red below.

We will not be styling the items inside the dropdown (highlighted in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.designerwpf.com/wp-content/uploads/2008/03/cb_dropdown_example.png" title="CB_Image_1"></a> This tutorial derives from the general &#8220;<a href="http://www.designerwpf.com/2008/02/07/the-wpf-designers-guide-to-styling-the-combobox/">How to Style the ComboBox</a>&#8221; set of tutorials.</p>
<p>First let&#8217;s make sure you&#8217;re in the right place. In this tutorial, we&#8217;re going to style the comboBox drop down (also known as the ComboBox popup) seen highlighted in red below.</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/03/cb_dropdown_example.png" alt="CB_Image_1" /></p>
<p>We will not be styling the items inside the dropdown (highlighted in blue). You can learn how to do that here.</p>
<p>So… let&#8217;s just go after some of the basics in styling the dropdown. We&#8217;ll give it a new background, a new border and we&#8217;ll round the edges to make it just a little more bubbly.</p>
<p>To start out, we&#8217;ll need to get to our comboBox control template, so right click on the comboBox in the Objects and Timeline window and go to &#8220;<strong>Edit Control Parts (Template) -&gt; Edit a Copy…</strong>&#8221;</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/03/cb_dropdown_edittemplate.png" alt="CB_Image_2" /></p>
<p>Name it something you like and we&#8217;re on our way. </p>
<p>We&#8217;ll be editing the <strong>PART_Popup</strong>. Whatever you do, don&#8217;t change the name to this sucker. Whenever you see a &#8220;PART_Something&#8221;, it is a necessary part of that specific control (hence the naming convention).</p>
<p>The ComboBox dropdown (which we&#8217;ll be calling a popup for the remainder of this post)<span>  </span>is made up of a low cost drop shadow (see <a href="http://www.designerwpf.com/2008/02/08/wpf-drop-shadows-on-the-cheap/">more on that here</a>), a border, a scrollviewer and the itemsPresenter.</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/03/cb_dropdown_guts.png" alt="CB_Image_3" /></p>
<p>Most of the standard styling we might want to do is probably going to happen in the Border titled DropDownBorder. We can alter the background and the border brushes easily enough by just changing them in the Properties window. But you may notice some quirky behavior from our scrollviewer when we change the CornerRadius. Below, I&#8217;ve changed the CornerRadius to &#8220;<strong>0,0,10,10</strong>&#8221; and we can see that we lose part of the corner under the scrollviewer.</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/03/cb_dropdown_borderconer.png" alt="CB_Image_4" /></p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/03/cb_dropdown_corner_eh.png" alt="CB_Image_5" /></p>
<p>We can solve this easily enough by adding some padding through the Border. Below I&#8217;ve added a padding of &#8220;<strong>0,0,2,6</strong>&#8220;.</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/03/cb_dropdown_corner_fixed.png" alt="CB_Image_6" /></p>
<p>Better, but not really ideal. In a perfect world, we would be able to say that the border us able to cut off its content in that nice pretty rounded manner.<span>  </span>(If anyone knows how to do that… let me know, I haven&#8217;t given it hours of thought yet, but I&#8217;d love to know). In this case, however, this sub-optimization is the price we&#8217;re going to have to pay if we don&#8217;t want to have to go in and mess with the scrollbar style and template.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/styling-the-combobox-dropdown-popup/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WPF Drop-Shadows on The Cheap</title>
		<link>http://blogs.veracitysolutions.com/wpf-drop-shadows-on-the-cheap/</link>
		<comments>http://blogs.veracitysolutions.com/wpf-drop-shadows-on-the-cheap/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 00:12:16 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.designerwpf.com/2008/02/08/wpf-drop-shadows-on-the-cheap/</guid>
		<description><![CDATA[One of the questions I get most often from designers and almost never from developers is:
How can I get drop shadows into my application without killing my performance?
 It is, of course, easy as punch and pie to get drop shadows into your application. You can just use the Bitmaps Effects panel in the Appearance section:
 
For [...]]]></description>
			<content:encoded><![CDATA[<p>One of the questions I get most often from designers and almost never from developers is:</p>
<p><strong>How can I get drop shadows into my application without killing my performance?</strong></p>
<p> It is, of course, easy as punch and pie to get drop shadows into your application. You can just use the Bitmaps Effects panel in the Appearance section:</p>
<p> <img src="http://www.designerwpf.com/wp-content/uploads/2008/02/ordinarydropshadow.png" alt="OrdinaryDropShadowing" /></p>
<p><em>For the love of God, please do not use the Bitmap Effects in the Appearance section!</em></p>
<p>If any developers found out that I told you to use BitmapEffects, they would hunt me down and cut off my fingers. This is because, while the Bitmap Effects in WPF are all sorts of cool, they make your computer break down into uncontrollable sobbing. Bitmap Effects hog system resources by requiring software rendering for render-heavy effects. There is no better way to slow down a perfectly good application than to give every other element a drop shadow.</p>
<p>But, what if you really <em>really</em> want to?</p>
<p><span id="more-244"></span></p>
<p>That is why there is this handy little thing called a &#8220;SystemDropShadowChrome&#8221;. The way to use it is to put the following namespace into your Window tag:</p>
<p><font color="#0000ff">xmlns:dropShadow</font>=&#8221;<font color="#ff0000">clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero</font>&#8221;<br />
<br />
And then take the thing you want to have a drop shadow and wrap it in a SystemDropShadowChrome like so:</p>
<p><font color="#0000ff">&lt;</font><font color="#800000">dropShadow:SystemDropShadowChrome</font><font color="#0000ff">&gt;</font><br />
<font color="#0000ff">      &lt;</font><font color="#800000">Grid</font> <font color="#ff0000">x:Name</font>=&#8221;<font color="#0000ff">MyElement</font>&#8221; <font color="#0000ff">/&gt;</font><br />
<font color="#0000ff">&lt;/</font><font color="#800000">dropShadow:SystemDropShadowChrome</font><font color="#0000ff">&gt;</font></p>
<p>So what are we losing when we do this?</p>
<p>Normal bitmap dropshadows give you the following options:</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/02/ordinarydropshadowoptions.png" alt="OrdinaryDropShadowOptions" /></p>
<p>And they conform to the item to which they are attached. It could be bannana-shaped… you would get a banana-shaped drop shadow.</p>
<p>But with SystemDropShadowChrome, you get a rectangle and the ability to choose the color of your drop-shadow and the corner-radius. That&#8217;s it. But that gives you a decent amount of room to work with. Consider what <a href="http://notstatic.com/archives/68">Robby Ingebretsen did in his example on SystemDropShadowChrome </a>(magnified 2X):</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/02/dropshadowexamples.png" alt="EasyDropShadowExamples" /></p>
<p>We&#8217;ve got darker drop shadows, lighter drop shadows, colored drop shadows and a drop shadow with an irregular corner radius. This is flexible enough for pretty much any standard application control. Used in templates, you could even use this to give drop shadow to just one part of the control. In fact, my attention was first drawn to the use of the drop shadow in the Popup part of the ComboBox control.</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/02/comboboxdropshadowexample.png" alt="ComboBoxDropShadowExample" /></p>
<p>You can change the drop shadow color using a standard color picker in the &#8220;Miscellaneous&#8221; section of the SystemDropShadowChrome properties in Blend:</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/02/colorpickerdropshadow.png" alt="DropShadowColorPickerExample" /></p>
<p>This is also where you can find the &#8220;CornerRadius&#8221; property. In the XAML, they will look like this:</p>
<p><font color="#0000ff">&lt;</font><font color="#800000">dropShadow:SystemDropShadowChrome</font> <font color="#ff0000">CornerRadius</font>=&#8221;<font color="#0000ff">3,13,3,13</font>&#8221; <font color="#ff0000">Color</font>=&#8221;<font color="#0000ff">#71000000</font>&#8220;<font color="#0000ff">&gt;</font><br />
<font color="#0000ff"><font color="#000000">      </font>&lt;</font><font color="#800000">Grid</font> <font color="#ff0000">x:Name</font>=&#8221;<font color="#0000ff">MyElement</font>&#8221; <font color="#0000ff">/&gt;</font><br />
<font color="#0000ff">&lt;/</font><font color="#800000">dropShadow:SystemDropShadowChrome</font>&gt;</p>
<p>With some creative styling, we can actually change the direction of the drop shadow. It&#8217;s easy enough to do if you&#8217;re just hacking away, but if you plan on using it seriously in an application, it requires some forethought and organization, so I&#8217;ll go into that in detail in a full post on changing the SystemDropShadowChrome direction. (coming soon)</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/wpf-drop-shadows-on-the-cheap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Do I Style The ComboBox Items?</title>
		<link>http://blogs.veracitysolutions.com/how-do-i-style-the-combobox-items/</link>
		<comments>http://blogs.veracitysolutions.com/how-do-i-style-the-combobox-items/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 06:45:21 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[Combobox]]></category>
		<category><![CDATA[How To...]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>
		<category><![CDATA[itemcontainerstyle]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[Triggers]]></category>

		<guid isPermaLink="false">http://www.designerwpf.com/2008/02/07/how-do-i-style-the-combobox-items/</guid>
		<description><![CDATA[This is actually a continuation of my post on getting the ComboBox items to accept text wrapping, so I&#8217;ll be working from that point forward. If you&#8217;re coming fresh into this, you won&#8217;t be missing anything&#8230; but that is my explaination for the pictures containing wrapping text.
When last we left our heroes, we has a [...]]]></description>
			<content:encoded><![CDATA[<p>This is actually a continuation of my post on <a href="http://www.designerwpf.com/2008/02/04/how-do-i-wrap-text-in-the-combobox/">getting the ComboBox items to accept text wrapping</a>, so I&#8217;ll be working from that point forward. If you&#8217;re coming fresh into this, you won&#8217;t be missing anything&#8230; but that is my explaination for the pictures containing wrapping text.</p>
<p>When last we left our heroes, we has a couple problems. The first was that our items were either black text on a white background and ran together in a very un-designer-y way.</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/02/basicview.png" alt="BeginningViewComboStyling" /></p>
<p>The second was that the selected item background makes your eyes bleed such a horrid blue color you&#8217;ll feel like Paul Atreides staring at a stone burner.</p>
<p>Was that a little too geek? My apologies.</p>
<p><span id="more-236"></span></p>
<p>Anyway, let&#8217;s do something to make this control a little more usable (as well as easier on our eyes).</p>
<p>Highlight your ComboBox and go up to the toolbar, selecting <strong>Object -&gt; Edit Other Styles -&gt; Edit ItemContainerStyle -&gt; Edit a Copy…</strong></p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/02/itemcontainerstylemenu.png" alt="ItemContainerStyleMenuCombo" /></p>
<p>We&#8217;re now in the ItemContainerStyle editing mode. I really just need some demarcation between the items, so I&#8217;m going to give the items a BorderBush with a gradient that has a nice blue at the top and fades down to transparency at the bottom. It looks something like this:</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/02/borderbrushgradient.png" alt="BorderBrushGradient" /></p>
<p>We will, of course, want our users to see this border, so let&#8217;s give the style a BorderThickness of 1 all around and a Margin of 4 to offer a little space. Our items now look like this:</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/02/stylework.png" alt="ComboboxItemsStylingWork" /></p>
<p>Better… but we don&#8217;t see the trigger for that hideous shade of blue in the style, so we need to go somewhere else to change it. Right click on the Style and go to <strong>Edit ControlParts (Template) -&gt; Edit Template</strong></p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/02/templatemenu.png" alt="TemplateMenu" /></p>
<p>We can see that the template here is exceedingly dull… just a border surrounding a ContentPresenter. We like dull. Dull means it&#8217;s not complex. First, let&#8217;s do some polishing up… give that border a CornerRadius of 5. Keep in mind that this is Vista-based development… no sharp corners allowed.</p>
<p>Now, let&#8217;s kill that blue. Click on the <strong>&#8220;IsHighlighted = True&#8221;</strong> trigger at the top…</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/02/ishighlightedtrigger.png" alt="IsHighlightedTrigger" /></p>
<p>..and we can see the highlighted state. I changed the Background to a nice soft blue gradient (you can change it to a deep purple with a green bubble for all I care… it&#8217;s WPF, go nuts!) This would be great except that I can&#8217;t see the Foreground now, so let&#8217;s change that to make the text readable.</p>
<p> I couldn&#8217;t figure out how to do this in the design mode, so find the IsHighlighted Trigger in the XAML and insert the bold text below:</p>
<p><font color="#0000ff">&lt;</font><font color="#800000">Trigger</font> <font color="#ff0000">Property</font>=&#8221;<font color="#0000ff">IsHighlighted</font>&#8221; <font color="#ff0000">Value</font>=&#8221;<font color="#0000ff">true</font>&#8220;<font color="#0000ff">&gt;</font><br />
      <font color="#0000ff">&lt;</font><font color="#800000">Setter</font> <font color="#ff0000">Property</font>=&#8221;<font color="#0000ff">Foreground</font>&#8221; <font color="#ff0000">Value</font>=&#8221;<font color="#0000ff">#FF001720</font>&#8220;<font color="#0000ff">/&gt;<br />
</font>      <font color="#0000ff">&lt;</font><font color="#800000">Setter</font> <font color="#ff0000">Property</font>=&#8221;<font color="#0000ff">Background</font>&#8221; <font color="#ff0000">TargetName</font>=&#8221;<font color="#0000ff">Bd</font>&#8220;<font color="#0000ff">&gt;<br />
      &#8230;</font></p>
<p>Now our ComboBox items look like this:</p>
<p><img src="http://www.designerwpf.com/wp-content/uploads/2008/02/finalcomboboxitems.png" alt="FinalComboBoxItems" /></p>
<p>Much better.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.veracitysolutions.com/how-do-i-style-the-combobox-items/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
