<?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/"
	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>Comments on: PropertyDescriptor AddValueChanged Alternative</title>
	<atom:link href="http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/feed/" rel="self" type="application/rss+xml" />
	<link>http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/</link>
	<description>Random Thoughts about C#, VS, WinForms, WPF and .NET in General</description>
	<lastBuildDate>Tue, 22 Dec 2009 20:10:23 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: jon</title>
		<link>http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-178</link>
		<dc:creator>jon</dc:creator>
		<pubDate>Mon, 23 Feb 2009 15:18:11 +0000</pubDate>
		<guid isPermaLink="false">http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-178</guid>
		<description>If you are just replacing the AddValueChanged to use this, remember you will need a reference to the notifier, the previous way (DependencyPropertyDescriptor) did as it has an internal hash map.  maybe save someone a few minutes</description>
		<content:encoded><![CDATA[<p>If you are just replacing the AddValueChanged to use this, remember you will need a reference to the notifier, the previous way (DependencyPropertyDescriptor) did as it has an internal hash map.  maybe save someone a few minutes</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jon</title>
		<link>http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-177</link>
		<dc:creator>jon</dc:creator>
		<pubDate>Mon, 23 Feb 2009 15:15:36 +0000</pubDate>
		<guid isPermaLink="false">http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-177</guid>
		<description>If you change this line

if (null != notifier.ValueChanged)
notifier.ValueChanged(notifier, EventArgs.Empty);

to this, you will get the correct sender in the event

if (null != notifier.ValueChanged)
notifier.ValueChanged(notifier.PropertySource, EventArgs.Empty);</description>
		<content:encoded><![CDATA[<p>If you change this line</p>
<p>if (null != notifier.ValueChanged)<br />
notifier.ValueChanged(notifier, EventArgs.Empty);</p>
<p>to this, you will get the correct sender in the event</p>
<p>if (null != notifier.ValueChanged)<br />
notifier.ValueChanged(notifier.PropertySource, EventArgs.Empty);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-174</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Wed, 03 Dec 2008 20:57:14 +0000</pubDate>
		<guid isPermaLink="false">http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-174</guid>
		<description>Hey Andrew, I had been looking all day for a replacement for WPF&#039;s DependencyPropertyDescriptor and I came across this article.  Unfortunately it looks like they removed the Bindable() attribute from the final Silverlight release - do you have an update to this code that works in the final bits?
Thanks,
Bob</description>
		<content:encoded><![CDATA[<p>Hey Andrew, I had been looking all day for a replacement for WPF&#8217;s DependencyPropertyDescriptor and I came across this article.  Unfortunately it looks like they removed the Bindable() attribute from the final Silverlight release &#8211; do you have an update to this code that works in the final bits?<br />
Thanks,<br />
Bob</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: agsmith</title>
		<link>http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-131</link>
		<dc:creator>agsmith</dc:creator>
		<pubDate>Tue, 26 Aug 2008 19:00:38 +0000</pubDate>
		<guid isPermaLink="false">http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-131</guid>
		<description>Thanks. I&#039;m glad it helped. 
If you look at the internal ValueChangedEventManager class in the PresentationFramework assembly (which is what MS is using for this) you can see that they are using a custom class (ValueChangedRecord) to add a handler for the property changed of the PD and that class has a reference back to the WeakEventManager (and the listenerlist) and uses the manager&#039;s DeliverEventToList method instead of the DeliverEvent method.</description>
		<content:encoded><![CDATA[<p>Thanks. I&#8217;m glad it helped.<br />
If you look at the internal ValueChangedEventManager class in the PresentationFramework assembly (which is what MS is using for this) you can see that they are using a custom class (ValueChangedRecord) to add a handler for the property changed of the PD and that class has a reference back to the WeakEventManager (and the listenerlist) and uses the manager&#8217;s DeliverEventToList method instead of the DeliverEvent method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neelima</title>
		<link>http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-130</link>
		<dc:creator>Neelima</dc:creator>
		<pubDate>Tue, 26 Aug 2008 18:21:51 +0000</pubDate>
		<guid isPermaLink="false">http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-130</guid>
		<description>Correction to my above comment 

The reason being, the way you attach the event in weakeventmanager is 

source.Event += DeliverEvent;</description>
		<content:encoded><![CDATA[<p>Correction to my above comment </p>
<p>The reason being, the way you attach the event in weakeventmanager is </p>
<p>source.Event += DeliverEvent;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neelima</title>
		<link>http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-129</link>
		<dc:creator>Neelima</dc:creator>
		<pubDate>Tue, 26 Aug 2008 18:21:15 +0000</pubDate>
		<guid isPermaLink="false">http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-129</guid>
		<description>Hi Andrew,

Thanks for this great article! It really helped a lot with cleaning up the code I am working on currently. 

I have been using WeakEventManager class with some other events but I have not been able to come up with a way to use it with DependencyPropertyDescriptor. 

The reason being, the way you attach the event in weakeventmanager is 

source.&lt;&gt; = DeliverEvent;

I am not able to fit DependencyPropertyDescripter into that structure.

Please let me know if you have any suggestions.</description>
		<content:encoded><![CDATA[<p>Hi Andrew,</p>
<p>Thanks for this great article! It really helped a lot with cleaning up the code I am working on currently. </p>
<p>I have been using WeakEventManager class with some other events but I have not been able to come up with a way to use it with DependencyPropertyDescriptor. </p>
<p>The reason being, the way you attach the event in weakeventmanager is </p>
<p>source.&lt;&gt; = DeliverEvent;</p>
<p>I am not able to fit DependencyPropertyDescripter into that structure.</p>
<p>Please let me know if you have any suggestions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Smith</title>
		<link>http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-109</link>
		<dc:creator>Josh Smith</dc:creator>
		<pubDate>Wed, 09 Apr 2008 17:49:29 +0000</pubDate>
		<guid isPermaLink="false">http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-109</guid>
		<description>Thanks.  That makes sense.</description>
		<content:encoded><![CDATA[<p>Thanks.  That makes sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: agsmith</title>
		<link>http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-108</link>
		<dc:creator>agsmith</dc:creator>
		<pubDate>Wed, 09 Apr 2008 17:44:42 +0000</pubDate>
		<guid isPermaLink="false">http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-108</guid>
		<description>No, it won&#039;t leak memory if you remove the handler. When the last handler is removed, the item is removed from the hashtable. But if you&#039;re relying on say an item being removed from the collection before you remove the handler, that may not happen - e.g. if you just close the form while the list is populated. In that case, you might be able to also unhook within the Unloaded event but then you have to know to re-hook again should your element get reloaded (e.g. if the element is in a tab control and you switch to another tab and back).</description>
		<content:encoded><![CDATA[<p>No, it won&#8217;t leak memory if you remove the handler. When the last handler is removed, the item is removed from the hashtable. But if you&#8217;re relying on say an item being removed from the collection before you remove the handler, that may not happen &#8211; e.g. if you just close the form while the list is populated. In that case, you might be able to also unhook within the Unloaded event but then you have to know to re-hook again should your element get reloaded (e.g. if the element is in a tab control and you switch to another tab and back).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Smith</title>
		<link>http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-107</link>
		<dc:creator>Josh Smith</dc:creator>
		<pubDate>Wed, 09 Apr 2008 17:22:35 +0000</pubDate>
		<guid isPermaLink="false">http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-107</guid>
		<description>Nice solution, Andrew.  I like how you use Binding&#039;s internal weakref in this case.  Very cool!

One question for you...does the memory leak still exist if you call RemoveValueChanged on the property descriptor?  Does that remove the entry from the internal hashtable?  

Thanks,
Josh</description>
		<content:encoded><![CDATA[<p>Nice solution, Andrew.  I like how you use Binding&#8217;s internal weakref in this case.  Very cool!</p>
<p>One question for you&#8230;does the memory leak still exist if you call RemoveValueChanged on the property descriptor?  Does that remove the entry from the internal hashtable?  </p>
<p>Thanks,<br />
Josh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Shifflett</title>
		<link>http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-106</link>
		<dc:creator>Karl Shifflett</dc:creator>
		<pubDate>Wed, 09 Apr 2008 10:55:35 +0000</pubDate>
		<guid isPermaLink="false">http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/#comment-106</guid>
		<description>Andrew,

Very nice!  Thank you for sharing this solution.

Cheers,

Karl</description>
		<content:encoded><![CDATA[<p>Andrew,</p>
<p>Very nice!  Thank you for sharing this solution.</p>
<p>Cheers,</p>
<p>Karl</p>
]]></content:encoded>
	</item>
</channel>
</rss>
