<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Qiweiye's Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/qiweiye/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/qiweiye/feed.xml</link>
    <description>About DotNet, WPF</description>
    <lastBuildDate>Wed, 17 Apr 2019 04:05:41 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>WPF related articles on MSDN magazine of Feb 2009</title>
      <link>https://docs.microsoft.com/archive/blogs/qiweiye/wpf-related-articles-on-msdn-magazine-of-feb-2009</link>
      <pubDate>Mon, 02 Mar 2009 11:00:08 GMT</pubDate>
      <dc:creator><![CDATA[qiweiye]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/qiweiye/2009/03/02/wpf-related-articles-on-msdn-magazine-of-feb-2009/</guid>
      <description><![CDATA[WPF Apps With The Model-View-ViewModel Design Pattern...]]></description>
      <content:encoded><![CDATA[<p><strong>WPF Apps With The Model-View-ViewModel Design Pattern</strong></p>  <p><a href="https://msdn.microsoft.com/en-us/magazine/dd419663.aspx">https://msdn.microsoft.com/en-us/magazine/dd419663.aspx</a></p>  <p>written by Josh Smith. He has written lots of articles on WPF. </p>  <p>You can view them at his blog <a href="https://joshsmithonwpf.wordpress.com">joshsmithonwpf.wordpress.com</a></p>  <p>&#160;</p>  <p>&#160;</p>  <p><strong>Writing More Efficient ItemsControls</strong></p>  <p><a href="https://msdn.microsoft.com/en-us/magazine/dd483292.aspx">https://msdn.microsoft.com/en-us/magazine/dd483292.aspx</a></p>  <p>from Charles Petzold</p>]]></content:encoded>
    </item>
    <item>
      <title>New Hotkey in win7 beta1</title>
      <link>https://docs.microsoft.com/archive/blogs/qiweiye/new-hotkey-in-win7-beta1</link>
      <pubDate>Wed, 25 Feb 2009 00:56:32 GMT</pubDate>
      <dc:creator><![CDATA[qiweiye]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/qiweiye/2009/02/25/new-hotkey-in-win7-beta1/</guid>
      <description><![CDATA[Windows 7 beta 1 includes some handy new shortcut key combinations that allow you to navigate and...]]></description>
      <content:encoded><![CDATA[<p>Windows 7 beta 1 includes some handy new shortcut key combinations that allow you to navigate and manage the Windows workspace more efficiently. Here are 10 new Windows 7 shortcuts that will help you speed up your workflow (“Win” means the Windows Key): </p>  <p><strong>Win+Home:</strong> Clear all but the active window</p>  <p><strong>Win+Space:</strong> All windows become transparent so you can see through to the desktop</p>  <p><strong>Win+Up arrow:</strong> Maximize the active window</p>  <p><strong>Win+Down arrow:</strong> Minimize the active window or restore the window if it's maximized</p>  <p><strong>Win+Left/Right arrows:</strong> Dock the active window to each side of the monitor</p>  <p><strong>Win+Shift+Left/Right arrows:</strong> If you've got dual monitors, this will move the active window to the adjacent monitor</p>  <p><strong>Win+T:</strong> Shift focus to and scroll through items on the taskbar</p>  <p><strong>Win+P:</strong> Adjust presentation settings for your display</p>  <p><strong>Win+(+/-):</strong> Zoom in/out</p>  <p><strong>Shift+Click a taskbar item:</strong> Open a new instance of that particular application</p>]]></content:encoded>
    </item>
    <item>
      <title>DependencyProperty Precedence(4)</title>
      <link>https://docs.microsoft.com/archive/blogs/qiweiye/dependencyproperty-precedence4</link>
      <pubDate>Tue, 06 Jan 2009 21:36:51 GMT</pubDate>
      <dc:creator><![CDATA[qiweiye]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/qiweiye/2009/01/06/dependencyproperty-precedence4/</guid>
      <description><![CDATA[If you want to know that where the value of DependencyProperty comes from, there is a class called...]]></description>
      <content:encoded><![CDATA[<p>If you want to know that where the value of DependencyProperty comes from, there is a class called <strong>DependencyPropertyHelper</strong>. </p>  <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">   <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">     <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">class</span> DependencyPropertyHelper</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> {</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   3:</span>     <span style="color: #008000">// Methods</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> ValueSource GetValueSource(DependencyObject dependencyObject, DependencyProperty dependencyProperty);</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   5:</span> }</pre>
  </div>
</div>

<p>It just has one static method called GetValueSource and the parameters is dependencyObject instance and dependencyProperty instance.</p>

<p>The type of return value is ValueSource:</p>

<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
  <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">struct</span> ValueSource</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> {</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   3:</span>     <span style="color: #0000ff">public</span> BaseValueSource BaseValueSource { get; }</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">bool</span> IsExpression { get; }</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   5:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">bool</span> IsAnimated { get; }</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">bool</span> IsCoerced { get; }</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   7:</span> }</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>&#160; </pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   9:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">enum</span> BaseValueSource</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span> {</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  11:</span>     Unknown,</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>     Default,</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  13:</span>     Inherited,</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span>     DefaultStyle,</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  15:</span>     DefaultStyleTrigger,</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  16:</span>     Style,</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  17:</span>     TemplateTrigger,</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  18:</span>     StyleTrigger,</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  19:</span>     ImplicitStyleReference,</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  20:</span>     ParentTemplate,</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  21:</span>     ParentTemplateTrigger,</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  22:</span>     Local</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  23:</span> }</pre>
  </div>
</div>

<p>It contains some read-only properties. If you have time, you can use this method to get</p>

<p>the ValueSource of targetButton’s Width Property(code is attached in the preview post).</p>

<p>And you will understand the DependencyProperty precedence better!</p>

<p>I have tried and find that In some scenario, IsAnimation = true and IsCoerce = true.</p>]]></content:encoded>
    </item>
    <item>
      <title>DependencyProperty Precedence(3)</title>
      <link>https://docs.microsoft.com/archive/blogs/qiweiye/dependencyproperty-precedence3</link>
      <pubDate>Mon, 05 Jan 2009 21:58:24 GMT</pubDate>
      <dc:creator><![CDATA[qiweiye]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/qiweiye/2009/01/05/dependencyproperty-precedence3/</guid>
      <description><![CDATA[Let’s focused on the coercion of DP value.  In the precedence list, the coercion source is the...]]></description>
      <content:encoded><![CDATA[<p>Let’s focused on the coercion of DP value.</p>  <p>In the precedence list, the coercion source is the highest.</p>  <p>In order to verify it, I have created a class called CoercionButton.</p>  <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">   <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">     <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> CoercionButton : Button</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> {</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   3:</span>     <span style="color: #0000ff">static</span> CoercionButton()</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>     {</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   5:</span>         WidthProperty.OverrideMetadata(<span style="color: #0000ff">typeof</span>(CoercionButton), <span style="color: #0000ff">new</span> FrameworkPropertyMetadata(<span style="color: #0000ff">null</span>, OnCoerceValueCallback));</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>     }</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   7:</span>&#160; </pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>     <span style="color: #008000">// public delegate object CoerceValueCallback(DependencyObject d, object baseValue);</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   9:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">object</span> OnCoerceValueCallback(DependencyObject d, <span style="color: #0000ff">object</span> baseValue)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span>     {</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  11:</span>         <span style="color: #0000ff">return</span> 150.0;</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>     }</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  13:</span> }</pre>
  </div>
</div>

<p></p>

<p>It overrides the Metadata of WidthProperty and adds CoerceValueCallback. And in the callback, returns a constant value 150.0.</p>

<p>We change the “Target Button” from normal Button type to CoercionButton type.</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/qiweiye/WindowsLiveWriter/DependencyPropertyPrecedence3_92FD/Main-1_1.jpg" original-url="https://blogs.msdn.com/blogfiles/qiweiye/WindowsLiveWriter/DependencyPropertyPrecedence3_92FD/Main-1_1.jpg"><img title="Main-1" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="350" alt="Main-1" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/qiweiye/WindowsLiveWriter/DependencyPropertyPrecedence3_92FD/Main-1_thumb_1.jpg" original-url="https://blogs.msdn.com/blogfiles/qiweiye/WindowsLiveWriter/DependencyPropertyPrecedence3_92FD/Main-1_thumb_1.jpg" width="387" border="0" /></a> </p>

<p>But the event handler for other 4 buttons remain some.</p>

<p>No matter which button you clicks, the Width of “Target Button” is always 150.</p>

<p>And the animation doesn’t work.</p>]]></content:encoded>
    </item>
    <item>
      <title>DependencyProperty Precedence(2)</title>
      <link>https://docs.microsoft.com/archive/blogs/qiweiye/dependencyproperty-precedence2</link>
      <pubDate>Mon, 05 Jan 2009 03:08:00 GMT</pubDate>
      <dc:creator><![CDATA[qiweiye]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/qiweiye/2009/01/05/dependencyproperty-precedence2/</guid>
      <description><![CDATA[One common question is that: Why can’t change the DependencyProperty value after applying animation...]]></description>
      <content:encoded><![CDATA[<p>One common question is that: <strong>Why can’t change the DependencyProperty value after applying animation with a hold behavior and how to solve it?</strong></p>  <p>I have create a simple solution to go deep on coercion, animation and local value. You can download it by clicking following link. (it’s on Microsoft SkyDriver.)</p> <iframe style="border-right: #dde5e9 1px solid; padding-right: 0px; border-top: #dde5e9 1px solid; padding-left: 0px; padding-bottom: 0px; margin: 3px; border-left: #dde5e9 1px solid; width: 240px; padding-top: 0px; border-bottom: #dde5e9 1px solid; height: 66px; background-color: #ffffff" marginwidth="0" marginheight="0" src="https://cid-97afa0e04a8724d5.skydrive.live.com/embedrowdetail.aspx/Public/msdn%20blog%20resources/DependencyPropertyValuePrededence.zip" frameborder="0" scrolling="no"></iframe>  <p>In this solution, there are 2 projects.</p>  <p>Let’s focused on the WpfAnimationAndLocalValue project first(Another project will explained in the next post)</p>  <p>The snapshot of this program:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/qiweiye/WindowsLiveWriter/df6465a94361_DE9D/Main_1.jpg" original-url="https://blogs.msdn.com/blogfiles/qiweiye/WindowsLiveWriter/df6465a94361_DE9D/Main_1.jpg" mce_href="https://blogs.msdn.com/blogfiles/qiweiye/WindowsLiveWriter/df6465a94361_DE9D/Main_1.jpg"><img title="Main" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="386" alt="Main" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/qiweiye/WindowsLiveWriter/df6465a94361_DE9D/Main_thumb_1.jpg" original-url="https://blogs.msdn.com/blogfiles/qiweiye/WindowsLiveWriter/df6465a94361_DE9D/Main_thumb_1.jpg" width="430" border="0" mce_src="https://blogs.msdn.com/blogfiles/qiweiye/WindowsLiveWriter/df6465a94361_DE9D/Main_thumb_1.jpg" /></a> </p>  <p>There are 4 buttons you can click:</p>  <p>“Start animation” button(Button 1) :</p>  <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">   <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">     <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> StartAnimation(<span style="color: #0000ff">object</span> sender, RoutedEventArgs e)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> {</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   3:</span>     DoubleAnimation doubleAnimation = <span style="color: #0000ff">new</span> DoubleAnimation(300, <span style="color: #0000ff">new</span> Duration(TimeSpan.FromSeconds(2)), FillBehavior.HoldEnd);</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>     targetButton.BeginAnimation(Button.WidthProperty, doubleAnimation);</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   5:</span> }</pre>
  </div>
</div>

<p>
  <br />&#160;&#160;&#160; just apply double animation to Width property of TargetButton(its FillBehavior is HoldEnd) 

  <br /></p>
<a href="https://11011.net/software/vspaste" mce_href="https://11011.net/software/vspaste"></a><a href="https://11011.net/software/vspaste" mce_href="https://11011.net/software/vspaste"></a>

<p>“Set Width of Target Button to 200” button(Button 2)</p>

<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
  <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> SetButtonWidth(<span style="color: #0000ff">object</span> sender, RoutedEventArgs e)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> {</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   3:</span>     targetButton.Width = 200;</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span> }</pre>
  </div>
</div>

<p>“Clear Animation(Copying Value)” button (Button 3)</p>

<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
  <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> ClearAnimationWithCopy(<span style="color: #0000ff">object</span> sender, RoutedEventArgs e)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> {</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   3:</span>     targetButton.Width = targetButton.ActualWidth;</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>     targetButton.BeginAnimation(Button.WidthProperty, <span style="color: #0000ff">null</span>);</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   5:</span> }</pre>
  </div>
</div>
<a href="https://11011.net/software/vspaste" mce_href="https://11011.net/software/vspaste"></a><a href="https://11011.net/software/vspaste" mce_href="https://11011.net/software/vspaste"></a>

<p>“Clear Animation” button(Button 4)</p>

<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
  <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> ClearAnimation(<span style="color: #0000ff">object</span> sender, RoutedEventArgs e)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> {</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   3:</span>     targetButton.BeginAnimation(Button.WidthProperty, <span style="color: #0000ff">null</span>);</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span> }</pre>
  </div>
</div>

<pre class="code">Then following the below steps:</pre>

<pre class="code"><font face="Tahoma"><u><em><strong>Step 1</strong></em></u>: Click button 1 (animation starts and Width increased to 300)</font></pre>

<pre class="code"><font face="Tahoma"><strong><em><u>Step 2</u></em></strong>: Click button 2 (No change on the Width)</font></pre>

<pre class="code"><font face="Tahoma">This is the problem described at the start of this post. The root cause is that</font></pre>

<pre class="code"><font face="Tahoma">Animation value source has higher priority than local value. So the code</font></pre>

<pre class="code"><font face="Tahoma"> targetButton.Width = 200; </font></pre>

<pre class="code"><font face="Tahoma">has change the local value. </font></pre>

<pre class="code"><font face="Tahoma">But the effective value of Width comes from animation </font><font face="Tahoma">source.</font></pre>

<pre class="code"><font face="Tahoma"><strong><em><u>Step 3</u></em></strong>: Click button 4 (the Width changes to 200)</font></pre>

<pre class="code"><font face="Tahoma">After removing the animation, the effective value of Width is re-calculated.</font></pre>

<pre class="code"><font face="Tahoma">In this time, the local value is the source of effective value and since we has</font></pre>

<pre class="code"><font face="Tahoma">changed the local value of Width to 200. So the effective value of Width is 200.</font></pre>

<pre class="code"><font face="Tahoma"><em><u><strong>Step 4</strong></u></em>: Click button 1 again(animation starts and Width increased to 300)</font></pre>

<pre class="code"><font face="Tahoma"><strong><em><u>Step 5</u></em></strong>: Click button 3 (No change on the Width)</font></pre>

<pre class="code"><font face="Tahoma">  this step needs some explanations. </font></pre>

<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
  <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   1:</span> targetButton.Width = targetButton.ActualWidth;</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> targetButton.BeginAnimation(Button.WidthProperty, <span style="color: #0000ff">null</span>);</pre>
  </div>
</div>
<a href="https://11011.net/software/vspaste" mce_href="https://11011.net/software/vspaste"></a>

<pre class="code"><font face="Tahoma">Before removing animation, set the Width using ActualWidth.</font></pre>

<pre class="code"><font face="Tahoma">so it updates the local value of Width to effective value provided by animation.</font></pre>

<pre class="code"><font face="Tahoma">After removing animation, the local value becomes effective value of Width.</font></pre>

<pre class="code"><font face="Tahoma">So no change on the Width.</font></pre>

<pre class="code"><font face="Tahoma">You can compare this step 5 with step 3.</font></pre>

<pre class="code"><font face="Tahoma"><strong><em><u>Step 6</u></em></strong>: Click button 2(change Width to 200)</font></pre>

<pre class="code"><font face="Tahoma"> Since we remove the animation, we can change the value now.</font></pre>]]></content:encoded>
    </item>
    <item>
      <title>DependencyProperty Precedence(1)</title>
      <link>https://docs.microsoft.com/archive/blogs/qiweiye/dependencyproperty-precedence1</link>
      <pubDate>Mon, 05 Jan 2009 02:40:03 GMT</pubDate>
      <dc:creator><![CDATA[qiweiye]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/qiweiye/2009/01/05/dependencyproperty-precedence1/</guid>
      <description><![CDATA[You know that value of DependencyProperty may come from different sources and all there sources has...]]></description>
      <content:encoded><![CDATA[<p>You know that value of DependencyProperty may come from different sources and all there sources has some priority.</p>  <p>In this blog, I focus on the precedence list when calculating the value of DependencyProperty.</p>  <p>Highest precedence is listed first:   <br />From msdn:    <br /><a title="https://msdn.microsoft.com/en-us/library/ms743230.aspx" href="https://msdn.microsoft.com/en-us/library/ms743230.aspx">https://msdn.microsoft.com/en-us/library/ms743230.aspx</a></p>  <p>&#160;</p>  <p><font size="3">1 Property system coercion</font></p>  <p><font size="3">2 Active animations or animations with a Hold behavior</font></p>  <p><font size="3">3 Local value</font></p>  <p><font size="3">4 TemplatedParent template properties</font></p>  <p><font size="3">5 Implicit style</font></p>  <p><font size="3">6 Style triggers</font></p>  <p><font size="3">7 Template triggers</font></p>  <p><font size="3">8 Style setters</font></p>  <p><font size="3">9 Default(theme) style</font></p>  <p><font size="3">10 Inheritance</font></p>  <p><font size="3">11 Default value from dependency property metadata</font></p>  <p>In the next post, I will show some code to go deep.</p>]]></content:encoded>
    </item>
    <item>
      <title>MSDN Magazine Resource</title>
      <link>https://docs.microsoft.com/archive/blogs/qiweiye/msdn-magazine-resource</link>
      <pubDate>Tue, 30 Dec 2008 23:18:40 GMT</pubDate>
      <dc:creator><![CDATA[qiweiye]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/qiweiye/2008/12/30/msdn-magazine-resource/</guid>
      <description><![CDATA[You can view all magazines online at  https://msdn.microsoft.com/en-us/magazine/cc135865.aspx  Also...]]></description>
      <content:encoded><![CDATA[<p>You can view all magazines online at</p>  <p><a title="https://msdn.microsoft.com/en-us/magazine/cc135865.aspx" href="https://msdn.microsoft.com/en-us/magazine/cc135865.aspx">https://msdn.microsoft.com/en-us/magazine/cc135865.aspx</a></p>  <p>Also you can download them(.chm files) at</p>  <p><a title="https://msdn.microsoft.com/en-us/magazine/cc159440.aspx" href="https://msdn.microsoft.com/en-us/magazine/cc159440.aspx">https://msdn.microsoft.com/en-us/magazine/cc159440.aspx</a></p>  <p>&#160;</p>  <p>Enjoy!</p>]]></content:encoded>
    </item>
    <item>
      <title>DeepEarth</title>
      <link>https://docs.microsoft.com/archive/blogs/qiweiye/deepearth</link>
      <pubDate>Mon, 29 Dec 2008 23:05:54 GMT</pubDate>
      <dc:creator><![CDATA[qiweiye]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/qiweiye/2008/12/29/deepearth/</guid>
      <description><![CDATA[You know that the DeepZoom tech provided in Silverlight 2.0 is very cool. And can you image...]]></description>
      <content:encoded><![CDATA[<p>You know that the DeepZoom tech provided in Silverlight 2.0 is very cool. And can you image combining the DeepZoom with Microsoft VirtualEarth?</p>  <p>The answer is DeepEarth.</p>  <p><em>“ DeepEarth is a mapping control powered by the combination of Microsoft’s Silverlight 2.0 platform and the DeepZoom (MuliScaleImage) control. At its core, it builds on these innovative technologies to provide an architecture for bringing together layers for services, data providers, and your own custom mapping elements together into an impressive user experience. Also featured are in depth examples of how you can leverage Virtual Earth Web Services to take advantage of advanced GIS service functionality. This is what you need to get an interactive, native Silverlight 2.0, map into your application today.”</em></p>  <p>Read the article at InfoQ, click <a href="https://www.infoq.com/news/2008/12/DeepEarth;jsessionid=BC117993F5A12276E871F8AE1249D2BB">here</a></p>  <p>The project home is at <a title="https://www.codeplex.com/deepearth" href="https://www.codeplex.com/deepearth">https://www.codeplex.com/deepearth</a></p>  <p>And you can view the example at</p>  <p><a title="https://deepearth.soulsolutions.com.au/" href="https://deepearth.soulsolutions.com.au/">https://deepearth.soulsolutions.com.au/</a></p>  <p>In this online demo, I think the control on the top-left corner is cool.</p>]]></content:encoded>
    </item>
    <item>
      <title>Render Text On A Path With WPF</title>
      <link>https://docs.microsoft.com/archive/blogs/qiweiye/render-text-on-a-path-with-wpf</link>
      <pubDate>Sat, 27 Dec 2008 04:03:00 GMT</pubDate>
      <dc:creator><![CDATA[qiweiye]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/qiweiye/2008/12/27/render-text-on-a-path-with-wpf/</guid>
      <description><![CDATA[Very great article from Charles Petzold.  You can view it at:...]]></description>
      <content:encoded><![CDATA[<p>Very great article from Charles Petzold.</p>  <p>You can view it at:</p>  <p><a title="https://msdn.microsoft.com/en-us/magazine/dd263097.aspx?pr=blog" href="https://msdn.microsoft.com/en-us/magazine/dd263097.aspx?pr=blog" mce_href="https://msdn.microsoft.com/en-us/magazine/dd263097.aspx?pr=blog">https://msdn.microsoft.com/en-us/magazine/dd263097.aspx?pr=blog</a></p>  <p>I create a xps version, you can download from my skydriver by clicking below link:</p> <iframe style="border-right: #dde5e9 1px solid; padding-right: 0px; border-top: #dde5e9 1px solid; padding-left: 0px; padding-bottom: 0px; margin: 3px; border-left: #dde5e9 1px solid; width: 240px; padding-top: 0px; border-bottom: #dde5e9 1px solid; height: 66px; background-color: #ffffff" marginwidth="0" marginheight="0" src="https://cid-97afa0e04a8724d5.skydrive.live.com/embedrowdetail.aspx/Public/Foundations%20Columns%20by%20Charles%20Petzold/Render%20Text%20On%20A%20Path%20With%20WPF.xps" frameborder="0" scrolling="no"></iframe>]]></content:encoded>
    </item>
    <item>
      <title>.Net Framework 4 Universe in DeepZoom</title>
      <link>https://docs.microsoft.com/archive/blogs/qiweiye/net-framework-4-universe-in-deepzoom</link>
      <pubDate>Sat, 27 Dec 2008 02:48:14 GMT</pubDate>
      <dc:creator><![CDATA[qiweiye]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/qiweiye/2008/12/27/net-framework-4-universe-in-deepzoom/</guid>
      <description><![CDATA[Microsoft announced Visual Studio 2010 and the .NET Framework 4.0 on September 29, 2008 which marks...]]></description>
      <content:encoded><![CDATA[<p>Microsoft<a href="https://www.microsoft.com/presspass/press/2008/sep08/09-29VS10PR.mspx"> announced</a> Visual Studio 2010 and the .NET Framework 4.0 on September 29, 2008 which marks the next generation of developer tools from Microsoft.     <br />Based upon .NET Framework 4.0 , Brad Abrams released a poster &quot;<a href="https://blogs.msdn.com/brada/archive/2008/10/29/net-framework-4-poster.aspx">.Net Framework 4.0 universe</a>&quot; , which gives you a clear view of new stuffs in .NET Framework 4.0. It’s using Silverlight DeepZoom technology.</p>  <p>Very Cool!</p>]]></content:encoded>
    </item>
  </channel>
</rss>