<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>2,000 Things You Should Know About WPF</title>
	<atom:link href="http://wpf.2000things.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpf.2000things.com</link>
	<description>Everything a WPF Developer Needs to Know, in Bite-Sized Chunks</description>
	<lastBuildDate>Thu, 23 Feb 2012 11:00:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='wpf.2000things.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/96cfc0c116be8a3fdedb05f3d276adb4?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>2,000 Things You Should Know About WPF</title>
		<link>http://wpf.2000things.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://wpf.2000things.com/osd.xml" title="2,000 Things You Should Know About WPF" />
	<atom:link rel='hub' href='http://wpf.2000things.com/?pushpress=hub'/>
		<item>
		<title>#500 &#8211; Sharing an Event Handler Across Multiple Controls, Method 1</title>
		<link>http://wpf.2000things.com/2012/02/23/500-sharing-an-event-handler-across-multiple-controls-method-1/</link>
		<comments>http://wpf.2000things.com/2012/02/23/500-sharing-an-event-handler-across-multiple-controls-method-1/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 11:00:12 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Event Handler]]></category>
		<category><![CDATA[RoutedEventArgs]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpf.2000things.com/?p=4246</guid>
		<description><![CDATA[You can use the same event handler for more than one control by specifying the handler for each control and pointing to the same event handler code. In the example below, we have three buttons, each of which wires up a handler for the Click event, but using the same handler (Button_Click). In the Button_Click event [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4246&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You can use the same event handler for more than one control by specifying the handler for each control and pointing to the same event handler code.</p>
<p>In the example below, we have three buttons, each of which wires up a handler for the <strong>Click</strong> event, but using the same handler (<strong>Button_Click</strong>).</p>
<p><pre class="brush: xml;">
    &lt;StackPanel&gt;
        &lt;Button Content=&quot;Keaton&quot; HorizontalAlignment=&quot;Center&quot; Padding=&quot;10,5&quot; Margin=&quot;5&quot;
                Click=&quot;Button_Click&quot;/&gt;
        &lt;Button Content=&quot;Chaplin&quot; HorizontalAlignment=&quot;Center&quot; Padding=&quot;10,5&quot; Margin=&quot;5&quot;
                Click=&quot;Button_Click&quot;/&gt;
        &lt;Button Content=&quot;Arbuckle&quot; HorizontalAlignment=&quot;Center&quot; Padding=&quot;10,5&quot; Margin=&quot;5&quot;
                Click=&quot;Button_Click&quot;/&gt;
    &lt;/StackPanel&gt;
</pre></p>
<p>In the <strong>Button_Click</strong> event handler, we can check the <strong>Source</strong> property of the <strong>RoutedEventArgs</strong> parameter to determine which button sent us the event.</p>
<p><pre class="brush: csharp;">
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // Get at originator of event using RoutedEventArgs.Source property

            Button b = e.Source as Button;
            MessageBox.Show(string.Format(&quot;You clicked on {0} button&quot;, b.Content));
        }
</pre></p>
<p><a href="http://2000thingswpf.files.wordpress.com/2012/02/500-001.png"><img class="alignnone size-full wp-image-4252" title="500-001" src="http://2000thingswpf.files.wordpress.com/2012/02/500-001.png?w=630" alt=""   /></a></p>
<br />Filed under: <a href='http://wpf.2000things.com/category/events/'>Events</a> Tagged: <a href='http://wpf.2000things.com/tag/event-handler/'>Event Handler</a>, <a href='http://wpf.2000things.com/tag/events/'>Events</a>, <a href='http://wpf.2000things.com/tag/routedeventargs/'>RoutedEventArgs</a>, <a href='http://wpf.2000things.com/tag/wpf/'>WPF</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/2000thingswpf.wordpress.com/4246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/2000thingswpf.wordpress.com/4246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/2000thingswpf.wordpress.com/4246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/2000thingswpf.wordpress.com/4246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/2000thingswpf.wordpress.com/4246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/2000thingswpf.wordpress.com/4246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/2000thingswpf.wordpress.com/4246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/2000thingswpf.wordpress.com/4246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/2000thingswpf.wordpress.com/4246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/2000thingswpf.wordpress.com/4246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/2000thingswpf.wordpress.com/4246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/2000thingswpf.wordpress.com/4246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/2000thingswpf.wordpress.com/4246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/2000thingswpf.wordpress.com/4246/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4246&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpf.2000things.com/2012/02/23/500-sharing-an-event-handler-across-multiple-controls-method-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8922e4d5254d602ba3ed32dd073b5a4e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">spsexton</media:title>
		</media:content>

		<media:content url="http://2000thingswpf.files.wordpress.com/2012/02/500-001.png" medium="image">
			<media:title type="html">500-001</media:title>
		</media:content>
	</item>
		<item>
		<title>#499 &#8211; Interacting with the Control That Initiated an Event</title>
		<link>http://wpf.2000things.com/2012/02/22/499-interacting-with-the-control-that-initiated-an-event/</link>
		<comments>http://wpf.2000things.com/2012/02/22/499-interacting-with-the-control-that-initiated-an-event/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 11:00:06 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Controls]]></category>
		<category><![CDATA[Event Handlers]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpf.2000things.com/?p=4238</guid>
		<description><![CDATA[In WPF, you do not have to provide a name for every control in your user interface.  Since so much is accomplished through data binding, you often don&#8217;t need to interact with a control at all from your code. But one scenario where you might want to interact with a control is from an event [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4238&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In WPF, you <a href="http://wpf.2000things.com/2011/05/13/299-controls-do-not-need-a-name/">do not have to provide a name</a> for every control in your user interface.  Since so much is accomplished through data binding, you often don&#8217;t need to interact with a control at all from your code.</p>
<p>But one scenario where you might want to interact with a control is from an event handler for an event that the control initiated.  Every event handler will have a <strong>sender</strong> argument that represents the control that fired the event.  You can cast this argument to the appropriate type to get at the original control.</p>
<p><pre class="brush: xml;">
&lt;Button Content=&quot;Click Me&quot; HorizontalAlignment=&quot;Center&quot; Padding=&quot;10,5&quot; Margin=&quot;10&quot;
        Click=&quot;Button_Click&quot;/&gt;
</pre><br />
<pre class="brush: csharp;">
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button b = sender as Button;
            b.Width = b.ActualWidth + 1;
        }
</pre></p>
<br />Filed under: <a href='http://wpf.2000things.com/category/controls/'>Controls</a> Tagged: <a href='http://wpf.2000things.com/tag/controls/'>Controls</a>, <a href='http://wpf.2000things.com/tag/event-handlers/'>Event Handlers</a>, <a href='http://wpf.2000things.com/tag/wpf/'>WPF</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/2000thingswpf.wordpress.com/4238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/2000thingswpf.wordpress.com/4238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/2000thingswpf.wordpress.com/4238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/2000thingswpf.wordpress.com/4238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/2000thingswpf.wordpress.com/4238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/2000thingswpf.wordpress.com/4238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/2000thingswpf.wordpress.com/4238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/2000thingswpf.wordpress.com/4238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/2000thingswpf.wordpress.com/4238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/2000thingswpf.wordpress.com/4238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/2000thingswpf.wordpress.com/4238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/2000thingswpf.wordpress.com/4238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/2000thingswpf.wordpress.com/4238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/2000thingswpf.wordpress.com/4238/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4238&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpf.2000things.com/2012/02/22/499-interacting-with-the-control-that-initiated-an-event/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8922e4d5254d602ba3ed32dd073b5a4e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">spsexton</media:title>
		</media:content>
	</item>
		<item>
		<title>No Post Today</title>
		<link>http://wpf.2000things.com/2012/02/21/no-post-today/</link>
		<comments>http://wpf.2000things.com/2012/02/21/no-post-today/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 12:28:42 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://wpf.2000things.com/?p=4236</guid>
		<description><![CDATA[2,000 Things / WPF is on hiatus today&#8211;back tomorrow. Filed under: Uncategorized<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4236&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>2,000 Things / WPF is on hiatus today&#8211;back tomorrow.</p>
<br />Filed under: <a href='http://wpf.2000things.com/category/uncategorized/'>Uncategorized</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/2000thingswpf.wordpress.com/4236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/2000thingswpf.wordpress.com/4236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/2000thingswpf.wordpress.com/4236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/2000thingswpf.wordpress.com/4236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/2000thingswpf.wordpress.com/4236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/2000thingswpf.wordpress.com/4236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/2000thingswpf.wordpress.com/4236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/2000thingswpf.wordpress.com/4236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/2000thingswpf.wordpress.com/4236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/2000thingswpf.wordpress.com/4236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/2000thingswpf.wordpress.com/4236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/2000thingswpf.wordpress.com/4236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/2000thingswpf.wordpress.com/4236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/2000thingswpf.wordpress.com/4236/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4236&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpf.2000things.com/2012/02/21/no-post-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8922e4d5254d602ba3ed32dd073b5a4e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">spsexton</media:title>
		</media:content>
	</item>
		<item>
		<title>#498 &#8211; A List of WPF Blogs and Forums</title>
		<link>http://wpf.2000things.com/2012/02/20/498-a-list-of-wpf-blogs-and-forums/</link>
		<comments>http://wpf.2000things.com/2012/02/20/498-a-list-of-wpf-blogs-and-forums/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 11:00:09 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Blogs]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpf.2000things.com/?p=4225</guid>
		<description><![CDATA[Though many WPF bloggers have long since moved on to greener pastures, there are still a few blogs out there that either still have good WPF content or that still blog about WPF/XAML.  Here is a list of the most useful blogs and forums. Attached WPF (Jason Rainwater) Bea Stollnitz on WPF and Silverlight Confessions [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4225&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Though many WPF bloggers have long since moved on to greener pastures, there are still a few blogs out there that either still have good WPF content or that still blog about WPF/XAML.  Here is a list of the most useful blogs and forums.</p>
<ul>
<li><a href="http://www.attachedwpf.com/blog/">Attached WPF</a> (Jason Rainwater)</li>
<li><a href="http://bea.stollnitz.com/blog/">Bea Stollnitz on WPF and Silverlight</a></li>
<li><a href="http://peteohanlon.wordpress.com/">Confessions of a Coder</a> (Pete O&#8217;Hanlon)</li>
<li><a href="http://marlongrech.wordpress.com/">C# Disciples</a> (Marlon Grech)</li>
<li><a href="http://blogs.msdn.com/b/delay/archive/tags/wpf/">Delay&#8217;s Blog</a> (David Anson)</li>
<li><a href="http://drwpf.com/blog/">Dr. WPF</a></li>
<li><a href="http://blogs.msdn.com/b/jaimer/">Jaime Rodriguez</a></li>
<li><a href="http://www.japf.fr/">JAPF</a> (Jeremy Alles)</li>
<li><a href="http://joshsmithonwpf.wordpress.com/">Josh Smith on WPF</a> (Josh Smith)</li>
<li><a href="http://joyfulwpf.blogspot.com/">Joymon&#8217;s World of WPF</a> (Joy George)</li>
<li><a href="http://kentb.blogspot.com/">Kent Boogaart</a></li>
<li><a href="http://blogs.msdn.com/b/llobo/">Lester&#8217;s WPF/SL Blog</a> (Lester Lobo)</li>
<li><a href="http://matthamilton.net/">Matt Hamilton.NET</a></li>
<li><a href="http://leomburke.wordpress.com/">Random Ramblings</a> (Leom Burke)</li>
<li><a href="http://robrelyea.wordpress.com/">Rob Relyea</a> (now blogging about Kinect for Windows)</li>
<li><a href="http://sachabarber.net/">sachabarber.net</a> (Sacha Barber)</li>
<li><a href="http://blogs.interknowlogy.com/author/timhuckaby/">Interknowlogy Blogs</a> (Tim Huckaby)</li>
<li><a href="http://www.julmar.com/blog/mark/">Wandering Through the Wilderness</a> (Mark Smith)</li>
<li><a href="http://windowsclient.net/wpf/">Windows Presentation Foundation</a> (Microsoft, WindowsClient.NET)</li>
<li><a href="http://wpf.codeplex.com/discussions">WPF Discussions</a> (Codeplex)</li>
<li><a href="http://social.msdn.microsoft.com/Forums/en/wpf/threads">WPF Forum</a> (MSDN)</li>
<li><a href="http://www.wpfpedia.com/">WPFpedia</a> (Actipro Software)</li>
<li><a href="http://www.codeproject.com/Articles/22980/WPF-A-Beginner-s-Guide-Part-1-of-n">WPF: A Beginner&#8217;s Guide</a> (Sacha Barber)</li>
<li><a href="http://blog.wpfwonderland.com/">XAML Wonderland</a> (Walt Ritscher)</li>
<li><a href="http://10rem.net/blog">10REM.NET</a> (Pete Brown)</li>
</ul>
<br />Filed under: <a href='http://wpf.2000things.com/category/miscellaneous/'>Miscellaneous</a> Tagged: <a href='http://wpf.2000things.com/tag/blogs/'>Blogs</a>, <a href='http://wpf.2000things.com/tag/miscellaneous/'>Miscellaneous</a>, <a href='http://wpf.2000things.com/tag/wpf/'>WPF</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/2000thingswpf.wordpress.com/4225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/2000thingswpf.wordpress.com/4225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/2000thingswpf.wordpress.com/4225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/2000thingswpf.wordpress.com/4225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/2000thingswpf.wordpress.com/4225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/2000thingswpf.wordpress.com/4225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/2000thingswpf.wordpress.com/4225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/2000thingswpf.wordpress.com/4225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/2000thingswpf.wordpress.com/4225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/2000thingswpf.wordpress.com/4225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/2000thingswpf.wordpress.com/4225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/2000thingswpf.wordpress.com/4225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/2000thingswpf.wordpress.com/4225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/2000thingswpf.wordpress.com/4225/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4225&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpf.2000things.com/2012/02/20/498-a-list-of-wpf-blogs-and-forums/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8922e4d5254d602ba3ed32dd073b5a4e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">spsexton</media:title>
		</media:content>
	</item>
		<item>
		<title>#497 &#8211; Use a UniformGrid to Make a Group of Buttons the Same Size</title>
		<link>http://wpf.2000things.com/2012/02/17/497-use-a-uniformgrid-to-make-a-group-of-buttons-the-same-size/</link>
		<comments>http://wpf.2000things.com/2012/02/17/497-use-a-uniformgrid-to-make-a-group-of-buttons-the-same-size/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 11:00:45 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Layout]]></category>
		<category><![CDATA[StackPanel]]></category>
		<category><![CDATA[UniformGrid]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpf.2000things.com/?p=4213</guid>
		<description><![CDATA[You can use a StackPanel to make its child elements the same size in one of its dimensions.  This is harder to do in the other dimension. The example below uses a StackPanel to contain some buttons.  They end up the same height, but are still different widths. You can make the buttons the same height [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4213&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You can use a <strong>StackPanel</strong> to <a href="http://wpf.2000things.com/2012/02/16/496-using-a-stackpanel-to-make-a-group-of-buttons-the-same-size/">make its child elements the same size</a> in one of its dimensions.  This is harder to do in the other dimension.</p>
<p>The example below uses a <strong>StackPanel</strong> to contain some buttons.  They end up the same height, but are still different widths.</p>
<p><a href="http://2000thingswpf.files.wordpress.com/2012/02/497-0011.png"><img class="alignnone size-full wp-image-4217" title="497-001" src="http://2000thingswpf.files.wordpress.com/2012/02/497-0011.png?w=630" alt=""   /></a></p>
<p>You can make the buttons the same height and width using a <strong>UniformGrid</strong> instead of a <strong>StackPanel</strong>.</p>
<p><pre class="brush: xml;">
        &lt;UniformGrid DockPanel.Dock=&quot;Bottom&quot; Margin=&quot;10&quot; Rows=&quot;1&quot; HorizontalAlignment=&quot;Right&quot;
                    VerticalAlignment=&quot;Bottom&quot;&gt;
            &lt;Button Grid.Column=&quot;0&quot; Content=&quot;No&quot; FontSize=&quot;18&quot; Margin=&quot;5&quot; Padding=&quot;6,3&quot;/&gt;
            &lt;Button Grid.Column=&quot;1&quot; Content=&quot;Yes, Absolutely&quot; Margin=&quot;5&quot; Padding=&quot;6,3&quot;/&gt;
            &lt;Button Grid.Column=&quot;2&quot; Content=&quot;Maybe&quot; Margin=&quot;5&quot; Padding=&quot;6,3&quot;/&gt;
        &lt;/UniformGrid&gt;
</pre></p>
<p>The <strong>UniformGrid</strong> will make sure that each cell is the same height and the same width.  This is desirable because you then avoid having to set the button sizes manually.</p>
<p><a href="http://2000thingswpf.files.wordpress.com/2012/02/497-002.png"><img class="alignnone size-full wp-image-4218" title="497-002" src="http://2000thingswpf.files.wordpress.com/2012/02/497-002.png?w=630" alt=""   /></a></p>
<br />Filed under: <a href='http://wpf.2000things.com/category/layout/'>Layout</a> Tagged: <a href='http://wpf.2000things.com/tag/layout/'>Layout</a>, <a href='http://wpf.2000things.com/tag/stackpanel/'>StackPanel</a>, <a href='http://wpf.2000things.com/tag/uniformgrid/'>UniformGrid</a>, <a href='http://wpf.2000things.com/tag/wpf/'>WPF</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/2000thingswpf.wordpress.com/4213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/2000thingswpf.wordpress.com/4213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/2000thingswpf.wordpress.com/4213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/2000thingswpf.wordpress.com/4213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/2000thingswpf.wordpress.com/4213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/2000thingswpf.wordpress.com/4213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/2000thingswpf.wordpress.com/4213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/2000thingswpf.wordpress.com/4213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/2000thingswpf.wordpress.com/4213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/2000thingswpf.wordpress.com/4213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/2000thingswpf.wordpress.com/4213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/2000thingswpf.wordpress.com/4213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/2000thingswpf.wordpress.com/4213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/2000thingswpf.wordpress.com/4213/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4213&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpf.2000things.com/2012/02/17/497-use-a-uniformgrid-to-make-a-group-of-buttons-the-same-size/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8922e4d5254d602ba3ed32dd073b5a4e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">spsexton</media:title>
		</media:content>

		<media:content url="http://2000thingswpf.files.wordpress.com/2012/02/497-0011.png" medium="image">
			<media:title type="html">497-001</media:title>
		</media:content>

		<media:content url="http://2000thingswpf.files.wordpress.com/2012/02/497-002.png" medium="image">
			<media:title type="html">497-002</media:title>
		</media:content>
	</item>
		<item>
		<title>#496 &#8211; Using a StackPanel to Make a Group of Buttons the Same Size</title>
		<link>http://wpf.2000things.com/2012/02/16/496-using-a-stackpanel-to-make-a-group-of-buttons-the-same-size/</link>
		<comments>http://wpf.2000things.com/2012/02/16/496-using-a-stackpanel-to-make-a-group-of-buttons-the-same-size/#comments</comments>
		<pubDate>Thu, 16 Feb 2012 11:00:49 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Layout]]></category>
		<category><![CDATA[StackPanel]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpf.2000things.com/?p=4200</guid>
		<description><![CDATA[You&#8217;ll often want to stack a group of buttons in a GUI, vertically or horizontally.  You&#8217;d typically use a StackPanel to do this. Let&#8217;s say that you want a series of buttons stacked vertically on the right side of a window. We can use a DockPanel as the main container and add a StackPanel docked on the right [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4200&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You&#8217;ll often want to stack a group of buttons in a GUI, vertically or horizontally.  You&#8217;d typically use a <strong>StackPanel</strong> to do this.</p>
<p>Let&#8217;s say that you want a series of buttons stacked vertically on the right side of a window.</p>
<p><a href="http://2000thingswpf.files.wordpress.com/2012/02/496-001.png"><img class="alignnone size-full wp-image-4202" title="496-001" src="http://2000thingswpf.files.wordpress.com/2012/02/496-001.png?w=630" alt=""   /></a></p>
<p>We can use a <strong>DockPanel</strong> as the main container and add a <strong>StackPanel</strong> docked on the right and oriented vertically.  But when we do this, the <strong>StackPanel</strong> expands to fill the available space, as does each <strong>Button</strong>.</p>
<p><a href="http://2000thingswpf.files.wordpress.com/2012/02/496-002.png"><img class="alignnone size-full wp-image-4203" title="496-002" src="http://2000thingswpf.files.wordpress.com/2012/02/496-002.png?w=630" alt=""   /></a></p>
<p>The <strong>HorizontalAlignment</strong> of the <strong>StackPanel</strong> defaults to <strong>Stretch</strong>, as do each of the buttons.  We could set the <strong>HorizontalAlignment</strong> for each <strong>Button</strong> to <strong>Right, </strong>but the buttons now all size to fit their content, which is not quite what we want.</p>
<p><a href="http://2000thingswpf.files.wordpress.com/2012/02/496-003.png"><img class="alignnone size-full wp-image-4204" title="496-003" src="http://2000thingswpf.files.wordpress.com/2012/02/496-003.png?w=630" alt=""   /></a></p>
<p>What we really want is for the <strong>HorizontalAlignment</strong> of each <strong>Button</strong> to be <strong>Stretch</strong>, but for the <strong>HorizontalAlignment</strong> of the <strong>StackPanel </strong>itself to be <strong>Right.  </strong>This gives us what we want.</p>
<p><a href="http://2000thingswpf.files.wordpress.com/2012/02/496-004.png"><img class="alignnone size-full wp-image-4205" title="496-004" src="http://2000thingswpf.files.wordpress.com/2012/02/496-004.png?w=630" alt=""   /></a></p>
<br />Filed under: <a href='http://wpf.2000things.com/category/layout/'>Layout</a> Tagged: <a href='http://wpf.2000things.com/tag/layout/'>Layout</a>, <a href='http://wpf.2000things.com/tag/stackpanel/'>StackPanel</a>, <a href='http://wpf.2000things.com/tag/wpf/'>WPF</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/2000thingswpf.wordpress.com/4200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/2000thingswpf.wordpress.com/4200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/2000thingswpf.wordpress.com/4200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/2000thingswpf.wordpress.com/4200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/2000thingswpf.wordpress.com/4200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/2000thingswpf.wordpress.com/4200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/2000thingswpf.wordpress.com/4200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/2000thingswpf.wordpress.com/4200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/2000thingswpf.wordpress.com/4200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/2000thingswpf.wordpress.com/4200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/2000thingswpf.wordpress.com/4200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/2000thingswpf.wordpress.com/4200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/2000thingswpf.wordpress.com/4200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/2000thingswpf.wordpress.com/4200/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4200&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpf.2000things.com/2012/02/16/496-using-a-stackpanel-to-make-a-group-of-buttons-the-same-size/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8922e4d5254d602ba3ed32dd073b5a4e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">spsexton</media:title>
		</media:content>

		<media:content url="http://2000thingswpf.files.wordpress.com/2012/02/496-001.png" medium="image">
			<media:title type="html">496-001</media:title>
		</media:content>

		<media:content url="http://2000thingswpf.files.wordpress.com/2012/02/496-002.png" medium="image">
			<media:title type="html">496-002</media:title>
		</media:content>

		<media:content url="http://2000thingswpf.files.wordpress.com/2012/02/496-003.png" medium="image">
			<media:title type="html">496-003</media:title>
		</media:content>

		<media:content url="http://2000thingswpf.files.wordpress.com/2012/02/496-004.png" medium="image">
			<media:title type="html">496-004</media:title>
		</media:content>
	</item>
		<item>
		<title>#495 &#8211; Binding to a Visibility Property Without Using a Value Converter</title>
		<link>http://wpf.2000things.com/2012/02/15/495-binding-to-a-visibility-property-without-using-a-value-converter/</link>
		<comments>http://wpf.2000things.com/2012/02/15/495-binding-to-a-visibility-property-without-using-a-value-converter/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 11:00:44 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[Visibility]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpf.2000things.com/?p=4194</guid>
		<description><![CDATA[You can use a value converter to convert a string value to a value of type System.Windows.Visibility, allowing data binding to a Visibility property.  You can also just set a Visibility property directly to a string, avoiding the need for a value converter. In the example below, we bind to the Content property of a ComboBoxItem, which we access through [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4194&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You can <a href="http://wpf.2000things.com/2012/02/14/494-using-a-value-converter-to-bind-to-a-visibility-property/">use a value converter</a> to convert a string value to a value of type <strong>System.Windows.Visibility</strong>, allowing data binding to a <strong>Visibility</strong> property.  You can also just set a <strong>Visibility</strong> property directly to a string, avoiding the need for a value converter.</p>
<p>In the example below, we bind to the <strong>Content </strong>property of a <strong>ComboBoxItem</strong>, which we access through the <strong>SelectedValue</strong> property of a <strong>ComboBox</strong>.  Since <strong>Content</strong> contains a string, the binding to <strong>Visibility</strong> works without a conversion.</p>
<p><pre class="brush: xml;">
    &lt;StackPanel&gt;
        &lt;StackPanel Orientation=&quot;Horizontal&quot; Margin=&quot;10&quot;&gt;
            &lt;Label Content=&quot;Snoopy&quot; Margin=&quot;3&quot; Background=&quot;BurlyWood&quot;/&gt;
            &lt;Label Content=&quot;Waldo&quot; Margin=&quot;3&quot; Background=&quot;Thistle&quot;
                   Visibility=&quot;{Binding ElementName=cboVisibility, Path=SelectedValue.Content}&quot;/&gt;
            &lt;Label Content=&quot;Dagwood&quot; Margin=&quot;3&quot; Background=&quot;LightGreen&quot;/&gt;
        &lt;/StackPanel&gt;
        &lt;ComboBox Name=&quot;cboVisibility&quot; HorizontalAlignment=&quot;Center&quot; SelectedIndex=&quot;0&quot;&gt;
            &lt;ComboBox.Items&gt;
                &lt;ComboBoxItem Content=&quot;Visible&quot;/&gt;
                &lt;ComboBoxItem Content=&quot;Collapsed&quot;/&gt;
                &lt;ComboBoxItem Content=&quot;Hidden&quot;/&gt;
            &lt;/ComboBox.Items&gt;
        &lt;/ComboBox&gt;
        &lt;Label Content=&quot;Select visibility of middle Label&quot; HorizontalAlignment=&quot;Center&quot;/&gt;
    &lt;/StackPanel&gt;
</pre></p>
<br />Filed under: <a href='http://wpf.2000things.com/category/data-binding/'>Data Binding</a> Tagged: <a href='http://wpf.2000things.com/tag/data-binding/'>Data Binding</a>, <a href='http://wpf.2000things.com/tag/visibility/'>Visibility</a>, <a href='http://wpf.2000things.com/tag/wpf/'>WPF</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/2000thingswpf.wordpress.com/4194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/2000thingswpf.wordpress.com/4194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/2000thingswpf.wordpress.com/4194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/2000thingswpf.wordpress.com/4194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/2000thingswpf.wordpress.com/4194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/2000thingswpf.wordpress.com/4194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/2000thingswpf.wordpress.com/4194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/2000thingswpf.wordpress.com/4194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/2000thingswpf.wordpress.com/4194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/2000thingswpf.wordpress.com/4194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/2000thingswpf.wordpress.com/4194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/2000thingswpf.wordpress.com/4194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/2000thingswpf.wordpress.com/4194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/2000thingswpf.wordpress.com/4194/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4194&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpf.2000things.com/2012/02/15/495-binding-to-a-visibility-property-without-using-a-value-converter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8922e4d5254d602ba3ed32dd073b5a4e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">spsexton</media:title>
		</media:content>
	</item>
		<item>
		<title>#494 &#8211; Using a Value Converter to Bind to a Visibility Property</title>
		<link>http://wpf.2000things.com/2012/02/14/494-using-a-value-converter-to-bind-to-a-visibility-property/</link>
		<comments>http://wpf.2000things.com/2012/02/14/494-using-a-value-converter-to-bind-to-a-visibility-property/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 11:00:40 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[Visibility]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpf.2000things.com/?p=4183</guid>
		<description><![CDATA[You can bind the Visibility property of a control to a data item whose type is System.Windows.Visibility.  You can also bind to an item whose type is string, provided that the string values returned represent one of the enumerated values from the Visibility type. The example below shows how to use a value converter to convert [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4183&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You can bind the <strong>Visibility</strong> property of a control to a data item whose type is <strong>System.Windows.Visibility</strong>.  You can also bind to an item whose type is <strong>string</strong>, provided that the string values returned represent one of the enumerated values from the <strong>Visibility </strong>type.</p>
<p>The example below shows how to use a value converter to convert from the <strong>SelectedValue</strong> of a <strong>ComboBox</strong> (a <strong>ComboBoxItem</strong>) to the <strong>Visibility</strong> type.</p>
<p><pre class="brush: xml;">
        &lt;StackPanel Orientation=&quot;Horizontal&quot; Margin=&quot;10&quot;&gt;
            &lt;Label Content=&quot;Snoopy&quot; Margin=&quot;3&quot; Background=&quot;BurlyWood&quot;/&gt;
            &lt;Label Content=&quot;Waldo&quot; Margin=&quot;3&quot; Background=&quot;Thistle&quot;
                   Visibility=&quot;{Binding ElementName=cboVisibility, Path=SelectedValue, Converter={StaticResource cboVisibilityConverter}}&quot;/&gt;
            &lt;Label Content=&quot;Dagwood&quot; Margin=&quot;3&quot; Background=&quot;LightGreen&quot;/&gt;
        &lt;/StackPanel&gt;
        &lt;ComboBox Name=&quot;cboVisibility&quot; HorizontalAlignment=&quot;Center&quot; SelectedIndex=&quot;0&quot;&gt;
            &lt;ComboBox.Items&gt;
                &lt;ComboBoxItem Content=&quot;Visible&quot;/&gt;
                &lt;ComboBoxItem Content=&quot;Collapsed&quot;/&gt;
                &lt;ComboBoxItem Content=&quot;Hidden&quot;/&gt;
            &lt;/ComboBox.Items&gt;
        &lt;/ComboBox&gt;
</pre></p>
<p>Code for <strong>IValueConverter.Convert</strong>:</p>
<p><pre class="brush: csharp;">
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Visibility visibility = Visibility.Visible;

            try
            {
                if (value != null)
                {
                    ComboBoxItem item = (ComboBoxItem)value;
                    visibility = (Visibility)Enum.Parse(typeof(Visibility), (string)item.Content, false);
                }
            }
            catch { }

            return visibility;
        }
</pre></p>
<br />Filed under: <a href='http://wpf.2000things.com/category/data-binding/'>Data Binding</a> Tagged: <a href='http://wpf.2000things.com/tag/data-binding/'>Data Binding</a>, <a href='http://wpf.2000things.com/tag/visibility/'>Visibility</a>, <a href='http://wpf.2000things.com/tag/wpf/'>WPF</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/2000thingswpf.wordpress.com/4183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/2000thingswpf.wordpress.com/4183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/2000thingswpf.wordpress.com/4183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/2000thingswpf.wordpress.com/4183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/2000thingswpf.wordpress.com/4183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/2000thingswpf.wordpress.com/4183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/2000thingswpf.wordpress.com/4183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/2000thingswpf.wordpress.com/4183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/2000thingswpf.wordpress.com/4183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/2000thingswpf.wordpress.com/4183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/2000thingswpf.wordpress.com/4183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/2000thingswpf.wordpress.com/4183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/2000thingswpf.wordpress.com/4183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/2000thingswpf.wordpress.com/4183/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4183&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpf.2000things.com/2012/02/14/494-using-a-value-converter-to-bind-to-a-visibility-property/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8922e4d5254d602ba3ed32dd073b5a4e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">spsexton</media:title>
		</media:content>
	</item>
		<item>
		<title>#493 &#8211; Setting the Visibility of a User Interface Element</title>
		<link>http://wpf.2000things.com/2012/02/13/493-setting-the-visibility-of-a-user-interface-element/</link>
		<comments>http://wpf.2000things.com/2012/02/13/493-setting-the-visibility-of-a-user-interface-element/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 11:00:04 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Controls]]></category>
		<category><![CDATA[Collapsed]]></category>
		<category><![CDATA[Hidden]]></category>
		<category><![CDATA[Visibility]]></category>
		<category><![CDATA[Visible]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpf.2000things.com/?p=4173</guid>
		<description><![CDATA[You can set the visibility of any element that inherits from UIElement by settings its Visibility property to one of the three values listed below.  Because every child hosted in a panel derives from UIElement, this is how you hide/show child elements in a panel. Values for Visibility (of type System.Windows.Visibility): Visible &#8211; element is displayed Hidden [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4173&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You can set the visibility of any element that inherits from <strong>UIElement</strong> by settings its <strong>Visibility</strong> property to one of the three values listed below.  Because every child hosted in a panel derives from <strong>UIElement</strong>, this is how you hide/show child elements in a panel.</p>
<p>Values for <strong>Visibility </strong>(of type <strong>System.Windows.Visibility</strong>):</p>
<ul>
<li><strong>Visible</strong> &#8211; element is displayed</li>
<li><strong>Hidden</strong> &#8211; element is not displayed, but the space where it is located is preserved</li>
<li><strong>Collapsed</strong> &#8211; element is not displayed and space for it is not preserved</li>
</ul>
<p>Below is an example that lets a user toggle between the three possible values for the <strong>Visibility</strong> of the middle <strong>Label</strong>.</p>
<p><pre class="brush: xml;">
    &lt;StackPanel&gt;
        &lt;StackPanel Orientation=&quot;Horizontal&quot; Margin=&quot;10&quot;&gt;
            &lt;Label Content=&quot;Snoopy&quot; Margin=&quot;3&quot; Background=&quot;BurlyWood&quot;/&gt;
            &lt;Label Content=&quot;Waldo&quot; Margin=&quot;3&quot; Background=&quot;Thistle&quot;
                   Visibility=&quot;{Binding ElementName=cboVisibility, Path=SelectedValue, Converter={StaticResource cboVisibilityConverter}}&quot;/&gt;
            &lt;Label Content=&quot;Dagwood&quot; Margin=&quot;3&quot; Background=&quot;LightGreen&quot;/&gt;
        &lt;/StackPanel&gt;
        &lt;ComboBox Name=&quot;cboVisibility&quot; HorizontalAlignment=&quot;Center&quot; SelectedIndex=&quot;0&quot;&gt;
            &lt;ComboBox.Items&gt;
                &lt;ComboBoxItem Content=&quot;Visible&quot;/&gt;
                &lt;ComboBoxItem Content=&quot;Collapsed&quot;/&gt;
                &lt;ComboBoxItem Content=&quot;Hidden&quot;/&gt;
            &lt;/ComboBox.Items&gt;
        &lt;/ComboBox&gt;
        &lt;Label Content=&quot;Select visibility of middle Label&quot; HorizontalAlignment=&quot;Center&quot;/&gt;
    &lt;/StackPanel&gt;
</pre><br />
<a href="http://2000thingswpf.files.wordpress.com/2012/02/493-001.png"><img class="alignnone size-full wp-image-4177" title="493-001" src="http://2000thingswpf.files.wordpress.com/2012/02/493-001.png?w=630" alt=""   /></a><br />
<a href="http://2000thingswpf.files.wordpress.com/2012/02/493-002.png"><img class="alignnone size-full wp-image-4178" title="493-002" src="http://2000thingswpf.files.wordpress.com/2012/02/493-002.png?w=630" alt=""   /></a><br />
<a href="http://2000thingswpf.files.wordpress.com/2012/02/493-003.png"><img class="alignnone size-full wp-image-4179" title="493-003" src="http://2000thingswpf.files.wordpress.com/2012/02/493-003.png?w=630" alt=""   /></a></pre>
<br />Filed under: <a href='http://wpf.2000things.com/category/controls/'>Controls</a> Tagged: <a href='http://wpf.2000things.com/tag/collapsed/'>Collapsed</a>, <a href='http://wpf.2000things.com/tag/controls/'>Controls</a>, <a href='http://wpf.2000things.com/tag/hidden/'>Hidden</a>, <a href='http://wpf.2000things.com/tag/visibility/'>Visibility</a>, <a href='http://wpf.2000things.com/tag/visible/'>Visible</a>, <a href='http://wpf.2000things.com/tag/wpf/'>WPF</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/2000thingswpf.wordpress.com/4173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/2000thingswpf.wordpress.com/4173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/2000thingswpf.wordpress.com/4173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/2000thingswpf.wordpress.com/4173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/2000thingswpf.wordpress.com/4173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/2000thingswpf.wordpress.com/4173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/2000thingswpf.wordpress.com/4173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/2000thingswpf.wordpress.com/4173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/2000thingswpf.wordpress.com/4173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/2000thingswpf.wordpress.com/4173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/2000thingswpf.wordpress.com/4173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/2000thingswpf.wordpress.com/4173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/2000thingswpf.wordpress.com/4173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/2000thingswpf.wordpress.com/4173/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4173&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpf.2000things.com/2012/02/13/493-setting-the-visibility-of-a-user-interface-element/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8922e4d5254d602ba3ed32dd073b5a4e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">spsexton</media:title>
		</media:content>

		<media:content url="http://2000thingswpf.files.wordpress.com/2012/02/493-001.png" medium="image">
			<media:title type="html">493-001</media:title>
		</media:content>

		<media:content url="http://2000thingswpf.files.wordpress.com/2012/02/493-002.png" medium="image">
			<media:title type="html">493-002</media:title>
		</media:content>

		<media:content url="http://2000thingswpf.files.wordpress.com/2012/02/493-003.png" medium="image">
			<media:title type="html">493-003</media:title>
		</media:content>
	</item>
		<item>
		<title>#492 &#8211; Layout Can Change at Runtime</title>
		<link>http://wpf.2000things.com/2012/02/10/492-layout-can-change-at-runtime/</link>
		<comments>http://wpf.2000things.com/2012/02/10/492-layout-can-change-at-runtime/#comments</comments>
		<pubDate>Fri, 10 Feb 2012 11:00:41 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Layout]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpf.2000things.com/?p=4152</guid>
		<description><![CDATA[One benefit of flow-based layout, as opposed to coordinate-based layout, is that elements in the user interface will size to fit their content.  The GUI designer does not have to explicitly set the size and location of each child element. The layout containers in WPF don&#8217;t just position their child elements at design-time, but will [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4152&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One benefit of flow-based layout, as opposed to coordinate-based layout, is that elements in the user interface will size to fit their content.  The GUI designer does not have to explicitly set the size and location of each child element.</p>
<p>The layout containers in WPF don&#8217;t just position their child elements at design-time, but will re-measure and arrange their child elements when certain properties of the child elements change.  For example, if the <strong>Content</strong> property of a <strong>Label </strong>control changes, the parent container will update its layout based on the new text.</p>
<p>In the example below, when the <strong>Label </strong>containing the movie title changes, the buttons to its right shift.</p>
<p><pre class="brush: xml;">
    &lt;StackPanel&gt;
        &lt;Label Content=&quot;Have you seen this movie?&quot; Margin=&quot;3&quot;/&gt;
        &lt;StackPanel Orientation=&quot;Horizontal&quot;&gt;
            &lt;Label Content=&quot;{Binding NextMovieTitle}&quot; Margin=&quot;3&quot;/&gt;
            &lt;Button Content=&quot;Seen It&quot; Margin=&quot;3&quot;/&gt;
            &lt;Button Content=&quot;NOT Seen It&quot; Margin=&quot;3&quot;/&gt;
        &lt;/StackPanel&gt;
        &lt;Button Content=&quot;Next Movie&quot; HorizontalAlignment=&quot;Center&quot; Margin=&quot;3&quot;
                Click=&quot;btnNext_Click&quot;/&gt;
    &lt;/StackPanel&gt;
</pre><br />
<a href="http://2000thingswpf.files.wordpress.com/2012/02/492-001.png"><img class="alignnone size-full wp-image-4168" title="492-001" src="http://2000thingswpf.files.wordpress.com/2012/02/492-001.png?w=630" alt=""   /></a><br />
<a href="http://2000thingswpf.files.wordpress.com/2012/02/492-002.png"><img class="alignnone size-full wp-image-4169" title="492-002" src="http://2000thingswpf.files.wordpress.com/2012/02/492-002.png?w=630" alt=""   /></a></pre>
<br />Filed under: <a href='http://wpf.2000things.com/category/layout/'>Layout</a> Tagged: <a href='http://wpf.2000things.com/tag/layout/'>Layout</a>, <a href='http://wpf.2000things.com/tag/wpf/'>WPF</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/2000thingswpf.wordpress.com/4152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/2000thingswpf.wordpress.com/4152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/2000thingswpf.wordpress.com/4152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/2000thingswpf.wordpress.com/4152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/2000thingswpf.wordpress.com/4152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/2000thingswpf.wordpress.com/4152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/2000thingswpf.wordpress.com/4152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/2000thingswpf.wordpress.com/4152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/2000thingswpf.wordpress.com/4152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/2000thingswpf.wordpress.com/4152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/2000thingswpf.wordpress.com/4152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/2000thingswpf.wordpress.com/4152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/2000thingswpf.wordpress.com/4152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/2000thingswpf.wordpress.com/4152/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpf.2000things.com&amp;blog=14605478&amp;post=4152&amp;subd=2000thingswpf&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpf.2000things.com/2012/02/10/492-layout-can-change-at-runtime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8922e4d5254d602ba3ed32dd073b5a4e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">spsexton</media:title>
		</media:content>

		<media:content url="http://2000thingswpf.files.wordpress.com/2012/02/492-001.png" medium="image">
			<media:title type="html">492-001</media:title>
		</media:content>

		<media:content url="http://2000thingswpf.files.wordpress.com/2012/02/492-002.png" medium="image">
			<media:title type="html">492-002</media:title>
		</media:content>
	</item>
	</channel>
</rss>
