<?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>YL's blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/yl/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/yl/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 04:10:41 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Just got back to MSDN blog</title>
      <link>https://docs.microsoft.com/archive/blogs/yl/just-got-back-to-msdn-blog</link>
      <pubDate>Wed, 28 Jul 2010 15:55:42 GMT</pubDate>
      <dc:creator><![CDATA[Whyllee]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/yl/2010/07/28/just-got-back-to-msdn-blog/</guid>
      <description><![CDATA[I lost my access to msdn blog for a few month.&nbsp; Just figured out how to login.&nbsp; There were...]]></description>
      <content:encoded><![CDATA[<p>I lost my access to msdn blog for a few month.&nbsp; Just figured out how to login.&nbsp; There were WLID and my microsoft alias and display name, screen name, login name, etc.&nbsp; All kept my head spining, dizzy.&nbsp; Luckily, i got back after all.</p>]]></content:encoded>
    </item>
    <item>
      <title>{x:Type} and {x:Static} in Silverlight</title>
      <link>https://docs.microsoft.com/archive/blogs/yl/xtype-and-xstatic-in-silverlight</link>
      <pubDate>Wed, 22 Jul 2009 15:28:04 GMT</pubDate>
      <dc:creator><![CDATA[Whyllee]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/yl/2009/07/22/xtype-and-xstatic-in-silverlight/</guid>
      <description><![CDATA[The question:  Silverlight does not support {x:Type} and {x:Static} xaml markups so far in V3.&#160;...]]></description>
      <content:encoded><![CDATA[<h3><u><font color="#aad5ff">The question:</font></u></h3>  <p>Silverlight does not support {x:Type} and {x:Static} xaml markups so far in V3.&#160; They has been important building blocks in WPF applications.&#160; How can we get the benefit from them in Silverlight application as well?</p>  <p>{x:Type} in xaml is to provide a Type value to a property, such as this in WPF    <br /><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_5.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_5.png" width="404" height="22" /></p>  <p>In Silverlight, it works simpler in some way. For build in Type properties, such as Style.TargetType and ControlTemplate.TargetType, you can use:<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_7.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_7.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_2.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_2.png" width="334" height="24" /></a> </p>  <p>However, in Silverlight, if you define your own custom dependency property and want to use similar syntax to define the type in xaml, no luck.&#160; Silverlight xaml parser cannot recognize “local:MyListBox” as a Type.&#160; You can only get it as a string.&#160; And Silverlight does not support xaml markup extension yet, so you cannot define your own {GetType} either.</p>  <p>How can we assign a Type property in silverlight xaml?</p>  <h3><u><font color="#aad5ff">First thought (not a solution)</font></u></h3>  <p>How about using a static TypeProvider like this?<img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_3.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_3.png" width="506" height="68" />     <br />and<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_13.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_5.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_5.png" width="490" height="23" /></a>     <br />Unfortunately, {x:Static} is not supported in silverlight xaml either.</p>  <h3><u><font color="#aad5ff">Solution one</font></u></h3>  <p>Solutions one is to use static resource instead of the static class.&#160; It’s like a singleton (not a strict singleton though) to use a reference to an instance instead of static property.&#160; Suppose to change TypeProvider into a non-static class<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_11.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_11.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_4.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_4.png" width="455" height="72" /></a>     <br />and define the instance in app.xaml <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_15.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_15.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_6.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_6.png" width="333" height="49" /></a>     <br />Then you can reference the type in your xaml as this:     <br /><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_32.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_32.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_14.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_14.png" width="565" height="38" /></a>&#160; It requires the custom property “BuddyType” to be a dependency property to support binding, and binding has its runtime overhead.&#160; But it works just like {x:Type}, or just like {x:Static} if you look at it in a different perspective.</p>  <h3><u><font color="#aad5ff">Solution Two:</font></u></h3>  <p>As you might complaint, it looks clumsy.&#160; Depending on how are you going to use the Type, there might be more elegant way to solve this issue.</p>  <p>Suppose the type is serving as a factory pattern, where we are creating the instance of given type whenever a new type is assigned to the property.&#160; e.g.    <br /><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_19.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_19.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_8.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_8.png" width="528" height="188" /></a>     <br />We might find providing the Type through Binding is a detour to our task.&#160; We can use <a href="https://en.wikipedia.org/wiki/Prototype_pattern" target="_blank">Prototype Pattern</a> to serve the same purpose with much more elegant code.</p>  <p>First, we need IBuddy to be an ICloneable as this    <br /><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_22.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_22.png" width="172" height="66" />     <br />and implement it on every concrete type you want to create&#160; <br /><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_24.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_24.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_10.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_10.png" width="234" height="113" /></a>     <br />So you can define your prototype instance in App.xaml     <br /><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_26.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_26.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_11.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_11.png" width="321" height="51" /></a>     <br />Now, you can reference the prototype in your xaml code as <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_30.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_30.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_13.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_13.png" width="464" height="26" /></a>     <br />Because the factory is now using a prototype patter as this: <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_28.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_28.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_12.png" original-url="https://blogs.msdn.com/blogfiles/yl/WindowsLiveWriter/xtypeandxStaticinsilverlight_97BB/image_thumb_12.png" width="283" height="189" /></a>&#160;&#160;&#160; <br />Although the last solution appears to have more sample code in this blog post, it actually the most maintainable code because most code are within base class and constructions, the usage is very simple and fast.&#160; It also support plain property without going through the overhead of DP.</p>  <h3><u><font color="#aad5ff">Conclusion</font></u></h3>  <p>{x:Type} and {x:Static} are important xaml markup extensions, and we wish Silverlight will pick them up in the future release.&#160; However, until then, we have to live with the workarounds as above.</p>]]></content:encoded>
    </item>
    <item>
      <title>My very first blog on MSDN</title>
      <link>https://docs.microsoft.com/archive/blogs/yl/my-very-first-blog-on-msdn</link>
      <pubDate>Fri, 10 Jul 2009 16:39:48 GMT</pubDate>
      <dc:creator><![CDATA[Whyllee]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/yl/2009/07/10/my-very-first-blog-on-msdn/</guid>
      <description><![CDATA[Silverlight 3 and Expression 3 RC is launched today to the world.  My favorite feature in...]]></description>
      <content:encoded><![CDATA[<p><a href="https://www.microsoft.com/silverlight/seethelight/default.html">Silverlight 3 and Expression 3 RC</a> is launched today to the world.</p>  <p>My favorite feature in Silverlight 3 is the ability to install the silver app from web browser to your desktop.&#160; It really bridges the web application into client world and speed up the installation as simple as 3 clicks. (<a href="https://www.microsoft.com/silverlight/get-started/install/default.aspx">Get Silverlight 3 RTM NOW</a>!)</p>  <p>Since I’m a developer with <a href="https://www.microsoft.com/Expression/products/Blend_Overview.aspx">Expression Blend</a>, I could list a 100 new and fantastic features in Expression Blend 3 tirelessly, such as the revolutionary prototyping tool SketchFlow, animation with visual state manager, working with sample data, and the most exiting one for a developer as me is the extensible interface through Behaviors. (<a href="https://www.microsoft.com/expression/try-it">Try Expression Blend 3 RC with SketchFlow NOW</a>)</p>  <p>Behavior is a brand new way to provide code behind.&#160; As a developer, we’ve been used to event handlers, command bindings, or data bindings, through which we can provide code behind logics for the front end xaml UI.&#160; However, i found myself have to explain these concepts to the our designers friends in team again and again and they still cannot understand why our developers make things so complicated.&#160; It’s just like what I complained to them how “complicated” it is to draw a nice gel button with dozens of layers of highlights, shadows, reflections, glowing effects etc.</p>  <p>The Behaviors in <a href="https://www.microsoft.com/expression/">Blend 3 SDK</a> finally bridges the gap between developers and designers, well, not from the gel button side, but from the code behind side.&#160; With Behaviors, our developers can write many preset code behind logics and designer can simple drag&amp;drop them on art board or object tree and boom, it’s there, integrated and highly configurable and extensible.</p>  <p>This blog will discuss in more detail about how we developers can write these code behind and give our designer fellow a “wow” time and smile.&#160; Tune in.</p>]]></content:encoded>
    </item>
  </channel>
</rss>