<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: NETDUG: WPF Event Routing Sample Code</title>
	<atom:link href="http://elegantcode.com/2009/09/22/bsdg-wpf-event-routing-sample-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/09/22/bsdg-wpf-event-routing-sample-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=bsdg-wpf-event-routing-sample-code</link>
	<description></description>
	<lastBuildDate>Sun, 12 Feb 2012 18:54:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
	<item>
		<title>By: Another Steve</title>
		<link>http://elegantcode.com/2009/09/22/bsdg-wpf-event-routing-sample-code/comment-page-1/#comment-49411</link>
		<dc:creator>Another Steve</dc:creator>
		<pubDate>Thu, 24 Sep 2009 18:03:40 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/09/22/bsdg-wpf-event-routing-sample-code/#comment-49411</guid>
		<description>@Steve
Actually a better reason for not having the parameter check is that if Brian is correct and the event should never fire for anything other than a hyperlink, you would not want to mask the issue if it firing for any other reason by just bypassing the code.  A nice invalid cast exception will point immediately to an issue with your event structure that could be eating performance by routing unneeded events.</description>
		<content:encoded><![CDATA[<p>@Steve<br />
Actually a better reason for not having the parameter check is that if Brian is correct and the event should never fire for anything other than a hyperlink, you would not want to mask the issue if it firing for any other reason by just bypassing the code.  A nice invalid cast exception will point immediately to an issue with your event structure that could be eating performance by routing unneeded events.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Lagunas</title>
		<link>http://elegantcode.com/2009/09/22/bsdg-wpf-event-routing-sample-code/comment-page-1/#comment-49360</link>
		<dc:creator>Brian Lagunas</dc:creator>
		<pubDate>Wed, 23 Sep 2009 17:35:11 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/09/22/bsdg-wpf-event-routing-sample-code/#comment-49360</guid>
		<description>&lt;a href=&quot;#comment-49356&quot; rel=&quot;nofollow&quot;&gt;@Steve &lt;/a&gt; 

I understand that it is the one from ButtonBase, but based on my XAML there are no buttons in the element tree.  Therefore it will be a hyperlink that performs the event.  Granted, if I were to add a button to my element tree, I would need to check the source, but I am not going to add a button there, so I don&#039;t need to check my parameters in this example.</description>
		<content:encoded><![CDATA[<p><a href="#comment-49356" rel="nofollow">@Steve </a> </p>
<p>I understand that it is the one from ButtonBase, but based on my XAML there are no buttons in the element tree.  Therefore it will be a hyperlink that performs the event.  Granted, if I were to add a button to my element tree, I would need to check the source, but I am not going to add a button there, so I don&#8217;t need to check my parameters in this example.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://elegantcode.com/2009/09/22/bsdg-wpf-event-routing-sample-code/comment-page-1/#comment-49356</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 23 Sep 2009 15:16:42 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/09/22/bsdg-wpf-event-routing-sample-code/#comment-49356</guid>
		<description>&lt;a href=&quot;#comment-49344&quot; rel=&quot;nofollow&quot;&gt;@Brian Lagunas&lt;/a&gt; 
Actually, the Click event is the one from ButtonBase so adding a Button in your stackpanel will also invoke the method.</description>
		<content:encoded><![CDATA[<p><a href="#comment-49344" rel="nofollow">@Brian Lagunas</a><br />
Actually, the Click event is the one from ButtonBase so adding a Button in your stackpanel will also invoke the method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Lagunas</title>
		<link>http://elegantcode.com/2009/09/22/bsdg-wpf-event-routing-sample-code/comment-page-1/#comment-49344</link>
		<dc:creator>Brian Lagunas</dc:creator>
		<pubDate>Wed, 23 Sep 2009 00:45:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/09/22/bsdg-wpf-event-routing-sample-code/#comment-49344</guid>
		<description>&lt;a href=&quot;#comment-49340&quot; rel=&quot;nofollow&quot;&gt;@Steve &lt;/a&gt; 

I agree, you want a relevant method name, but I dissagree on checking the parameters.  I know that based on my XAML element hierarchy that the only items performing the attached Hyperlink.Click event is a hyperlink object, therefore it will be impossible for the e.Source to be anything but a hyperlink or for it to be null. But if it makes you feel all warm and fuzzy by adding the extra code to explicitly check the source, then knock yourself out.</description>
		<content:encoded><![CDATA[<p><a href="#comment-49340" rel="nofollow">@Steve </a> </p>
<p>I agree, you want a relevant method name, but I dissagree on checking the parameters.  I know that based on my XAML element hierarchy that the only items performing the attached Hyperlink.Click event is a hyperlink object, therefore it will be impossible for the e.Source to be anything but a hyperlink or for it to be null. But if it makes you feel all warm and fuzzy by adding the extra code to explicitly check the source, then knock yourself out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://elegantcode.com/2009/09/22/bsdg-wpf-event-routing-sample-code/comment-page-1/#comment-49340</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 22 Sep 2009 22:43:39 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/09/22/bsdg-wpf-event-routing-sample-code/#comment-49340</guid>
		<description>I know this is a quick piece of code to show how you can do it but lots of people will just copy paste it. So a good method name (HyperlinkClicked or something), and at least check the arguments

var hyperlink = e.Source as Hyperlink;
if (hyperlink != null)
  Process.Start(hyperlink.NavigateUri.ToString());</description>
		<content:encoded><![CDATA[<p>I know this is a quick piece of code to show how you can do it but lots of people will just copy paste it. So a good method name (HyperlinkClicked or something), and at least check the arguments</p>
<p>var hyperlink = e.Source as Hyperlink;<br />
if (hyperlink != null)<br />
  Process.Start(hyperlink.NavigateUri.ToString());</p>
]]></content:encoded>
	</item>
</channel>
</rss>

