<?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>PatriceLeVexier.com</title>
	<atom:link href="http://www.patricelevexier.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.patricelevexier.com</link>
	<description>Senior Software Developer</description>
	<lastBuildDate>Thu, 10 Jun 2010 03:39:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>DependencyProperty value change notification</title>
		<link>http://www.patricelevexier.com/http:/www.patricelevexier.com/blog</link>
		<comments>http://www.patricelevexier.com/http:/www.patricelevexier.com/blog#comments</comments>
		<pubDate>Thu, 10 Jun 2010 03:26:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.patricelevexier.com/?p=69</guid>
		<description><![CDATA[In order to get notified when a dependency property value changes, you can use the DependencyPropertyDescriptor.AddValueChanged function to register your own listener.
A simple example that displays the width of the window in a label:


public Window1()
{
InitializeComponent();

DependencyPropertyDescriptor widthDesc = DependencyPropertyDescriptor.FromProperty(Window.WidthProperty, typeof(Window));

if (widthDesc != null)
{
widthDesc.AddValueChanged(this, this.OnValueChanged);
}
}

private void OnValueChanged(object sender, EventArgs args)
{
txtLabel.Text = this.Width.ToString();
}

]]></description>
			<content:encoded><![CDATA[<p>In order to get notified when a dependency property value changes, you can use the <a title="DependencyPropertyDescriptor Class" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dependencypropertydescriptor.aspx" target="_blank">DependencyPropertyDescriptor</a>.AddValueChanged function to register your own listener.</p>
<p>A simple example that displays the width of the window in a label:</p>
<pre class="brush: csharp;">

public Window1()
{
InitializeComponent();

DependencyPropertyDescriptor widthDesc = DependencyPropertyDescriptor.FromProperty(Window.WidthProperty, typeof(Window));

if (widthDesc != null)
{
widthDesc.AddValueChanged(this, this.OnValueChanged);
}
}

private void OnValueChanged(object sender, EventArgs args)
{
txtLabel.Text = this.Width.ToString();
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.patricelevexier.com/http:/www.patricelevexier.com/blog/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
