<?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: Attached behaviours in WPF</title>
	<atom:link href="http://www.mindscapehq.com/blog/index.php/2009/02/01/attached-behaviours-in-wpf/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mindscapehq.com/blog/index.php/2009/02/01/attached-behaviours-in-wpf/</link>
	<description>The official blog of Mindscape</description>
	<lastBuildDate>Fri, 03 May 2013 12:47:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
	<item>
		<title>By: Ivan Towlson</title>
		<link>http://www.mindscapehq.com/blog/index.php/2009/02/01/attached-behaviours-in-wpf/comment-page-1/#comment-125370</link>
		<dc:creator>Ivan Towlson</dc:creator>
		<pubDate>Thu, 21 Jul 2011 20:53:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=486#comment-125370</guid>
		<description><![CDATA[The dependency properties are static because they are global objects.  (Remember, a DependencyProperty represents a property declaration, and is therefore at a class level, even though the values of that DP are per-instance.)  The change callbacks are therefore static because they have to be referenced from the static DP -- the DP is not associated with a specific DependencyObject *instance* on which it could perform the callback.  The callback only knows the instance when it gets a sender.

You can have the static callback delegate to an instance method by casting sender to the expected type, and calling an instance method on that.  However since attached behaviours are usually used to extend an object with functionality that isn&#039;t built in, such an instance method doesn&#039;t usually exist.  It is similar to why C# extension methods are static.]]></description>
		<content:encoded><![CDATA[<p>The dependency properties are static because they are global objects.  (Remember, a DependencyProperty represents a property declaration, and is therefore at a class level, even though the values of that DP are per-instance.)  The change callbacks are therefore static because they have to be referenced from the static DP &#8212; the DP is not associated with a specific DependencyObject *instance* on which it could perform the callback.  The callback only knows the instance when it gets a sender.</p>
<p>You can have the static callback delegate to an instance method by casting sender to the expected type, and calling an instance method on that.  However since attached behaviours are usually used to extend an object with functionality that isn&#8217;t built in, such an instance method doesn&#8217;t usually exist.  It is similar to why C# extension methods are static.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stukselbax</title>
		<link>http://www.mindscapehq.com/blog/index.php/2009/02/01/attached-behaviours-in-wpf/comment-page-1/#comment-125165</link>
		<dc:creator>stukselbax</dc:creator>
		<pubDate>Thu, 21 Jul 2011 07:45:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=486#comment-125165</guid>
		<description><![CDATA[Why attached properties[behavior] are static? Can they be non-static?]]></description>
		<content:encoded><![CDATA[<p>Why attached properties[behavior] are static? Can they be non-static?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan Towlson</title>
		<link>http://www.mindscapehq.com/blog/index.php/2009/02/01/attached-behaviours-in-wpf/comment-page-1/#comment-100143</link>
		<dc:creator>Ivan Towlson</dc:creator>
		<pubDate>Tue, 03 May 2011 22:04:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=486#comment-100143</guid>
		<description><![CDATA[Hi Duncan,

Afraid not.  I&#039;ve never been terribly clear on the purpose of the &#039;owner type&#039; thing on dependency properties, so I&#039;m not sure why it would impact the workings of the DP in styling.  Maybe the styling engine looks up DPs by their owner type rather than as properties of the qualifying (declaring) type; but that would mean directly setting the attached property worked in a different way, which seems weird.  Would be fascinated if you manage to find out anything more though!]]></description>
		<content:encoded><![CDATA[<p>Hi Duncan,</p>
<p>Afraid not.  I&#8217;ve never been terribly clear on the purpose of the &#8216;owner type&#8217; thing on dependency properties, so I&#8217;m not sure why it would impact the workings of the DP in styling.  Maybe the styling engine looks up DPs by their owner type rather than as properties of the qualifying (declaring) type; but that would mean directly setting the attached property worked in a different way, which seems weird.  Would be fascinated if you manage to find out anything more though!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Duncan Cole</title>
		<link>http://www.mindscapehq.com/blog/index.php/2009/02/01/attached-behaviours-in-wpf/comment-page-1/#comment-99481</link>
		<dc:creator>Duncan Cole</dc:creator>
		<pubDate>Mon, 02 May 2011 05:01:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=486#comment-99481</guid>
		<description><![CDATA[A bit late to the party here but I was also having issues with the Style not being able to resolve the attached property. If I set the attached property on the control then everything worked fine but putting it in a Style (whether that was in the Resources section of the Window/UserControl/App or in a separate ResourceDictionary file) just wasn&#039;t working. Then I noticed in the declaration of my attached property I had the owner type set to - typeof(OnScreenKeyboard) - instead of - typeof(OnScreenKeyboardBehaviours). Changing this fixed it all up, although I&#039;m not exactly sure why since directly setting the attached property on the control was working fine. Any ideas Ivan?]]></description>
		<content:encoded><![CDATA[<p>A bit late to the party here but I was also having issues with the Style not being able to resolve the attached property. If I set the attached property on the control then everything worked fine but putting it in a Style (whether that was in the Resources section of the Window/UserControl/App or in a separate ResourceDictionary file) just wasn&#8217;t working. Then I noticed in the declaration of my attached property I had the owner type set to &#8211; typeof(OnScreenKeyboard) &#8211; instead of &#8211; typeof(OnScreenKeyboardBehaviours). Changing this fixed it all up, although I&#8217;m not exactly sure why since directly setting the attached property on the control was working fine. Any ideas Ivan?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan Towlson</title>
		<link>http://www.mindscapehq.com/blog/index.php/2009/02/01/attached-behaviours-in-wpf/comment-page-1/#comment-59390</link>
		<dc:creator>Ivan Towlson</dc:creator>
		<pubDate>Fri, 26 Nov 2010 02:49:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=486#comment-59390</guid>
		<description><![CDATA[Hi Bob,

There&#039;s no reason you shouldn&#039;t be able to use an attached behaviour in a user control.  If you could throw up some repro code on pastebin or somewhere I&#039;d be glad to take a look.]]></description>
		<content:encoded><![CDATA[<p>Hi Bob,</p>
<p>There&#8217;s no reason you shouldn&#8217;t be able to use an attached behaviour in a user control.  If you could throw up some repro code on pastebin or somewhere I&#8217;d be glad to take a look.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bobr</title>
		<link>http://www.mindscapehq.com/blog/index.php/2009/02/01/attached-behaviours-in-wpf/comment-page-1/#comment-58740</link>
		<dc:creator>bobr</dc:creator>
		<pubDate>Tue, 23 Nov 2010 04:54:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=486#comment-58740</guid>
		<description><![CDATA[I am getting the exact same error. It works when I use the attached property in a project using a style in the window resources or application resources. But, when I create a UserControl in the same project and try to use it that way I get the exact same error:


            
            &lt;!-- digit-only --&gt;
        

What is going on here]]></description>
		<content:encoded><![CDATA[<p>I am getting the exact same error. It works when I use the attached property in a project using a style in the window resources or application resources. But, when I create a UserControl in the same project and try to use it that way I get the exact same error:</p>
<p>            <!-- digit-only --></p>
<p>What is going on here</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anand</title>
		<link>http://www.mindscapehq.com/blog/index.php/2009/02/01/attached-behaviours-in-wpf/comment-page-1/#comment-43853</link>
		<dc:creator>Anand</dc:creator>
		<pubDate>Thu, 29 Jul 2010 09:44:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=486#comment-43853</guid>
		<description><![CDATA[Nice article... very useful...]]></description>
		<content:encoded><![CDATA[<p>Nice article&#8230; very useful&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan Towlson</title>
		<link>http://www.mindscapehq.com/blog/index.php/2009/02/01/attached-behaviours-in-wpf/comment-page-1/#comment-36021</link>
		<dc:creator>Ivan Towlson</dc:creator>
		<pubDate>Thu, 26 Nov 2009 20:00:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=486#comment-36021</guid>
		<description><![CDATA[Hi Vishal,

Check the property name in the Setter.  It should be &quot;local:InputBehaviour.IsDigitOnly&quot;.  You may be missing the &quot;local:InputBehaviour.&quot; prefix.]]></description>
		<content:encoded><![CDATA[<p>Hi Vishal,</p>
<p>Check the property name in the Setter.  It should be &#8220;local:InputBehaviour.IsDigitOnly&#8221;.  You may be missing the &#8220;local:InputBehaviour.&#8221; prefix.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vishal Bhatt</title>
		<link>http://www.mindscapehq.com/blog/index.php/2009/02/01/attached-behaviours-in-wpf/comment-page-1/#comment-35994</link>
		<dc:creator>Vishal Bhatt</dc:creator>
		<pubDate>Wed, 25 Nov 2009 12:16:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=486#comment-35994</guid>
		<description><![CDATA[I am having the same problem, I am new to WPF and I want to keep separate XAML file for styles.

Any help will be appreciable.......]]></description>
		<content:encoded><![CDATA[<p>I am having the same problem, I am new to WPF and I want to keep separate XAML file for styles.</p>
<p>Any help will be appreciable&#8230;&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan Towlson</title>
		<link>http://www.mindscapehq.com/blog/index.php/2009/02/01/attached-behaviours-in-wpf/comment-page-1/#comment-34936</link>
		<dc:creator>Ivan Towlson</dc:creator>
		<pubDate>Tue, 06 Oct 2009 01:14:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=486#comment-34936</guid>
		<description><![CDATA[Hi ace,

It sounds like you may not be qualifying the property name in the style declaration.  Your setter should read:

&lt;Setter Property=&quot;local:InputBehaviour.IsDigitOnly&quot; Value=&quot;True&quot; /&gt;

Do you have the local:InputBehaviour qualifier?

I don&#039;t have a sample to hand but if you still get errors let me know and I&#039;ll dig one out!]]></description>
		<content:encoded><![CDATA[<p>Hi ace,</p>
<p>It sounds like you may not be qualifying the property name in the style declaration.  Your setter should read:</p>
<p><setter Property="local:InputBehaviour.IsDigitOnly" Value="True"></setter></p>
<p>Do you have the local:InputBehaviour qualifier?</p>
<p>I don&#8217;t have a sample to hand but if you still get errors let me know and I&#8217;ll dig one out!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic (Requested URI is rejected)
Database Caching 6/22 queries in 0.018 seconds using disk: basic

 Served from: www.mindscapehq.com @ 2013-05-22 12:48:06 by W3 Total Cache -->