<?xml-stylesheet type="text/xsl" href="/rss.xsl" media="screen"?><rss version="2.0"><channel><title>softlogger Latest Articles ::XML-XSLT</title><link>http://softlogger.com</link><description>softlogger Latest Articles ::XML-XSLT</description><ttl>180</ttl><item><title>Silverlight Browser Integration aka HTML Bridge</title><link>http://softlogger.com/20226/XML-XSLT/silverlight-browser-integration-aka-html-bridge.aspx</link><description>Given that Silverlight applications sit in the browser via a plug in, it would be silly if you couldn't interact from managed SL code with other browser elements, such as html elements and script so that you could, for example, reuse existing assets. I have heard the browser-agnostic integration featured described as &lt;strong&gt;HTML Bridge&lt;/strong&gt; and it is implemented in the &lt;code&gt;System.Windows.Browser.dll&lt;/code&gt; assembly in a &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.windows.browser(VS.95).aspx"&gt;same named namespace&lt;/a&gt;. You can see the types from that namespace on the following image (click on it for the &lt;a href="http://www.danielmoth.com/Blog/HtmBridgeExpanded.png"&gt;expanded version&lt;/a&gt;):&lt;br /&gt;&lt;a href="http://www.danielmoth.com/Blog/HtmBridgeExpanded.png"&gt;&lt;img src="http://www.danielmoth.com/Blog/HtmBridgeCollapsed.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The important inheritance hierarchy to be aware of is that &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.windows.browser.htmldocument_members(VS.95).aspx"&gt;HtmlDocument&lt;/a&gt; and &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.windows.browser.htmlelement_members(VS.95).aspx"&gt;HtmlElement&lt;/a&gt; inherit from &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.windows.browser.htmlobject_members(VS.95).aspx"&gt;HtmlObject&lt;/a&gt; (that allows handling script events via &lt;em&gt;AttachEvent&lt;/em&gt;) which inherits from &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.windows.browser.scriptobject_members(VS.95).aspx"&gt;ScriptObject&lt;/a&gt; (that allows you to execute scripts via its &lt;em&gt;Invoke&lt;/em&gt; and &lt;em&gt;InvokeSelf&lt;/em&gt; methods). &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.windows.browser.htmlpage_members(VS.95).aspx"&gt;HtmlPage&lt;/a&gt; is a great entry point because you can navigate across its &lt;em&gt;Window&lt;/em&gt; property to an &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.windows.browser.htmlwindow_members(VS.95).aspx"&gt;HtmlWindow&lt;/a&gt; (that allows e.g. to &lt;em&gt;Navigate&lt;/em&gt; URLs) and across its &lt;em&gt;Document&lt;/em&gt; property to an &lt;em&gt;HtmlDocument&lt;/em&gt; (that offers e.g. access to &lt;em&gt;Cookies&lt;/em&gt; and &lt;em&gt;QueryString&lt;/em&gt;). Also note the 2 Attribute classes: &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.windows.browser.scriptabletypeattribute_members(VS.95).aspx"&gt;ScriptableType&lt;/a&gt; and &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.windows.browser.scriptablememberattribute_members(VS.95).aspx"&gt;ScriptableMember&lt;/a&gt;. Those are used for exposing Silverlight managed classes to script in the browser combined with &lt;em&gt;HtmlPage&lt;/em&gt;.&lt;em&gt;RegisterScriptableObject&lt;/em&gt; and &lt;em&gt;RegisterCreateableType&lt;/em&gt; methods. Open the expanded class diagram in a separate window and identify the aforementioned methods. Notice there how &lt;em&gt;HtmlDocument&lt;/em&gt; allows you to create new elements and retrieve existing ones (&lt;em&gt;CreateElement&lt;/em&gt; and &lt;em&gt;GetElementById&lt;/em&gt;). Once you have references to those &lt;em&gt;HtmlElements&lt;/em&gt; you can do things like &lt;em&gt;SetAttribute&lt;/em&gt;, &lt;em&gt;SetStyleAttribute&lt;/em&gt; and &lt;em&gt;AppendChild&lt;/em&gt; to name a few. Script events are handled in your managed &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.windows.browser.scripteventhandler(VS.95).aspx"&gt;ScriptEventHandler&lt;/a&gt; method that accepts an &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.windows.browser.htmleventargs_members(VS.95).aspx"&gt;HtmlEventArgs&lt;/a&gt; which you can find on the class diagram along with its relationships (e.g. &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.windows.browser.mousebuttons(VS.95).aspx"&gt;MouseButtons&lt;/a&gt;). You should also checkout the &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.windows.browser.httputility_members(VS.95).aspx"&gt;HttpUtility&lt;/a&gt; class and its self-explanatory methods such as &lt;em&gt;UrlEncode&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;Phew! Take a moment to study the two class diagrams using the previous paragraph as a guide and also note that all links above are direct links to the API documentation (i.e. this blog post becomes my bookmark into MSDN ;)). You can also follow a quickstart (&lt;a href="http://silverlight.net/Quickstarts/Dom/DomAccess.aspx"&gt;DOM access&lt;/a&gt;), two walkthroughs (calling &lt;a href="http://msdn2.microsoft.com/en-gb/library/cc221414(VS.95).aspx"&gt;managed from script&lt;/a&gt; and &lt;a href="http://msdn2.microsoft.com/en-gb/library/cc221359(VS.95).aspx"&gt;script from managed&lt;/a&gt;), and for those that want even more, &lt;a href="http://download.microsoft.com/download/9/4/e/94e080c7-d462-4118-b07a-55578d64bc43/Silverlight%202%20Beta%201%20-%20Browser%20Integration.zip"&gt;follow this 2-hour lab (ZIP)&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To see some of the browser integration in action, I have here the &lt;a href="http://www.danielmoth.com/SL/HtmlBridge/"&gt;ugliest and most basic SL app that simply proves some of the concepts&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;br/&gt;&lt;hr/&gt;
&lt;span style="font-style: italic;font-size:85%;"&gt;Comments about this post welcome at &lt;a href="http://www.danielmoth.com/Blog/"&gt;the original blog&lt;/a&gt;&lt;/span&gt;.&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/DanielMoth?a=7aAS44F"&gt;&lt;img src="http://feeds.feedburner.com/~f/DanielMoth?i=7aAS44F" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/DanielMoth?a=o1qn9KF"&gt;&lt;img src="http://feeds.feedburner.com/~f/DanielMoth?i=o1qn9KF" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/DanielMoth?a=zBcUzJf"&gt;&lt;img src="http://feeds.feedburner.com/~f/DanielMoth?i=zBcUzJf" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/DanielMoth?a=7wOAgtf"&gt;&lt;img src="http://feeds.feedburner.com/~f/DanielMoth?i=7wOAgtf" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/DanielMoth?a=G27XqQF"&gt;&lt;img src="http://feeds.feedburner.com/~f/DanielMoth?i=G27XqQF" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/DanielMoth?a=30OjbNf"&gt;&lt;img src="http://feeds.feedburner.com/~f/DanielMoth?i=30OjbNf" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/DanielMoth?a=QiLszIF"&gt;&lt;img src="http://feeds.feedburner.com/~f/DanielMoth?i=QiLszIF" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DanielMoth/~4/248015140" height="1" width="1"/&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=20226"&gt;</description><author>The Moth</author><pubDate>2008-03-08T00:00:00</pubDate><category>XML/XSLT</category></item><item><title>DOC, XLS and PPT Binary File Format Specifications Released (plus WMF, Windows Compound File [aka OLE 2.0 Structured Storage] and Ink Serialized Format Specifications and Translator to XML news)</title><link>http://softlogger.com/19476/XML-XSLT/doc-xls-and-ppt-binary-file-format-specifications-released-plus-wmf-windows-compound-file-aka-ole-2-0-structured-storage-and-ink-serialized-format-specifications-and-translator-to-xml-news.aspx</link><description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/default.aspx"&gt;Brian Jones: Open XML Formats&lt;/a&gt; - &lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/02/15/binary-documentation-doc-xls-ppt-and-translator-project-site-are-now-live.aspx"&gt;Binary Documentation (.doc, .xls, .ppt) and Translator Project Site are now live&lt;/a&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;"As promised &lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/01/16/mapping-documents-in-the-binary-format-doc-xls-ppt-to-the-open-xml-format.aspx"&gt;last month&lt;/a&gt;, the binary documentation (.doc, .xls, .ppt) is now live. In addition to this, the project to create an open source translator (binary -&amp;gt; Open XML) has now been formed on sourceforge, and the development roadmap has been published. ...&lt;/p&gt; &lt;p&gt;...&lt;/p&gt; &lt;h4&gt;Office Binary (doc, xls, ppt) Translator to Open XML &lt;/h4&gt; &lt;p&gt;The "&lt;em&gt;Office Binary (doc, xls, ppt) Translator to Open XML&lt;/em&gt;" project is now live on sourceforge: &lt;a href="http://b2xtranslator.sourceforge.net/"&gt;http://b2xtranslator.sourceforge.net/ &lt;/a&gt; &lt;p&gt;...&lt;/p&gt; &lt;p&gt;While the project is still in its infancy, you can see what the planned project roadmap is, as well as an early draft of a mapping table between the Word binary format (.doc) and the Open XML format (.docx). &lt;/p&gt; &lt;h4&gt;Microsoft Office Binary (doc, xls, ppt) File Formats &lt;/h4&gt; &lt;p&gt;The binary documentation itself is available up here: &lt;a href="http://www.microsoft.com/interop/docs/OfficeBinaryFormats.mspx"&gt;http://www.microsoft.com/interop/docs/OfficeBinaryFormats.mspx&lt;/a&gt; &lt;ul&gt; &lt;li&gt;Word 97-2007 Binary File Format (.doc) Specification &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/Word97-2007BinaryFileFormat(doc)Specification.pdf"&gt;PDF&lt;/a&gt; | &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/Word97-2007BinaryFileFormat(doc)Specification.xps"&gt;XPS&lt;/a&gt; &lt;li&gt;&lt;a name="EJB"&gt;&lt;/a&gt;PowerPoint 97-2007 Binary File Format (.ppt) Specification &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/PowerPoint97-2007BinaryFileFormat(ppt)Specification.pdf"&gt;PDF&lt;/a&gt; | &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/PowerPoint97-2007BinaryFileFormat(ppt)Specification.xps"&gt;XPS&lt;/a&gt; &lt;li&gt;Excel 97-2007 Binary File Format (.xls) Specification &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/Excel97-2007BinaryFileFormat(xls)Specification.pdf"&gt;PDF&lt;/a&gt; | &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/Excel97-2007BinaryFileFormat(xls)Specification.xps"&gt;XPS&lt;/a&gt; &lt;li&gt;Office Drawing 97-2007 Binary Format Specification &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/OfficeDrawing97-2007BinaryFormatSpecification.pdf"&gt;PDF&lt;/a&gt; | &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/OfficeDrawing97-2007BinaryFormatSpecification.xps"&gt;XPS&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;It's all covered under the &lt;a href="http://www.microsoft.com/interop/osp"&gt;&lt;/a&gt;Open Specification Promise.  &lt;p&gt;Another great surprise in all of this is that we've made the documentation for a few other supporting technologies available as it may be of use to folks implementing the binary formats: &lt;a href="http://www.microsoft.com/interop/docs/supportingtechnologies.mspx"&gt;&lt;/a&gt;&lt;a href="http://www.microsoft.com/interop/docs/supportingtechnologies.mspx"&gt;http://www.microsoft.com/interop/docs/supportingtechnologies.mspx&lt;/a&gt; &lt;p&gt;The technologies included are:  &lt;ul&gt; &lt;li&gt;Windows Compound Binary File Format Specification &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/WindowsCompoundBinaryFileFormatSpecification.pdf"&gt;PDF&lt;/a&gt; | &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/WindowsCompoundBinaryFileFormatSpecification.xps"&gt;XPS&lt;/a&gt; &lt;li&gt;Windows Metafile Format (.wmf) Specification &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/WindowsMetafileFormat(wmf)Specification.pdf"&gt;PDF&lt;/a&gt; | &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/WindowsMetafileFormat(wmf)Specification.xps"&gt;XPS&lt;/a&gt; &lt;li&gt;Ink Serialized Format (ISF) Specification &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/InkSerializedFormat(ISF)Specification.pdf"&gt;PDF&lt;/a&gt; | &lt;a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/InkSerializedFormat(ISF)Specification.xps"&gt;XPS&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;..." &lt;strong&gt;[Post Leached 80%+]&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;I think this was a good move by Microsoft. Now what would be cool is to see them release more older file format specifications because they want to, not because they "have" too.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Related Past Post XRef:&lt;br&gt;&lt;a href="http://coolthingoftheday.blogspot.com/2008/01/microsoft-office-binary-file-format.html"&gt;Microsoft Office Binary File Format Specifications Coming to a Download Near You...&lt;/a&gt;&lt;/p&gt;  &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/coolthingoftheday?a=E86DYPE"&gt;&lt;img src="http://feeds.feedburner.com/~f/coolthingoftheday?i=E86DYPE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/coolthingoftheday?a=XFCIduE"&gt;&lt;img src="http://feeds.feedburner.com/~f/coolthingoftheday?i=XFCIduE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/coolthingoftheday?a=TPA4tME"&gt;&lt;img src="http://feeds.feedburner.com/~f/coolthingoftheday?i=TPA4tME" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/coolthingoftheday/~4/236253967" height="1" width="1"/&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=19476"&gt;</description><author>Gregs Cool [Insert Clever Name] of the Day</author><pubDate>2008-02-20T00:00:00</pubDate><category>XML/XSLT</category></item><item><title>Embedding Arbitrary XML in Faults</title><link>http://softlogger.com/19502/XML-XSLT/embedding-arbitrary-xml-in-faults.aspx</link><description>&lt;p&gt;&lt;span style="font-style: italic;"&gt;
How can I directly craft the XML content that goes into a fault detail?&lt;/span&gt;
&lt;/p&gt;&lt;p&gt;
Getting control over the detail element doesn't have to mean crafting the fault message yourself.  While WCF requires that the fault detail be serializable using a data contract, remember that DataContractSerializer treats XmlElement as a special primitive type.  This allows you to construct arbitrary content using XmlElement when your content can be represented as a rooted document.  Due to the automatic conversion process of FaultException to a fault message, you don't need to construct a data contract to act as a wrapper.
&lt;/p&gt;&lt;p&gt;
Here's a sample that builds some content in an XmlElement and uses it to construct a fault.  I made the method return a Message so that I could look at the response more easily but you can use any contract you want.
&lt;/p&gt;&lt;pre class="csharpcode"&gt;[ServiceContract]&lt;br&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IMyService&lt;br&gt;{&lt;br&gt;   [OperationContract]&lt;br&gt;   Message Fail();&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MyService : IMyService&lt;br&gt;{&lt;br&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; Message Fail()&lt;br&gt;   {&lt;br&gt;      XmlDocument document = &lt;span class="kwrd"&gt;new&lt;/span&gt; XmlDocument();&lt;br&gt;      XmlElement root = document.CreateElement(&lt;span class="str"&gt;"tag"&lt;/span&gt;);&lt;br&gt;      root.SetAttribute(&lt;span class="str"&gt;"attributeName"&lt;/span&gt;, &lt;span class="str"&gt;"value"&lt;/span&gt;);&lt;br&gt;      XmlElement subtag = document.CreateElement(&lt;span class="str"&gt;"moretags"&lt;/span&gt;);&lt;br&gt;      subtag.InnerText = &lt;span class="str"&gt;"blah"&lt;/span&gt;;&lt;br&gt;      root.AppendChild(subtag);&lt;br&gt;      &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; FaultException&amp;lt;XmlElement&amp;gt;(root);&lt;br&gt;   }&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;br&gt;{&lt;br&gt;   &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;br&gt;   {&lt;br&gt;      &lt;span class="kwrd"&gt;string&lt;/span&gt; address = &lt;span class="str"&gt;"http://localhost:8000/"&lt;/span&gt;;&lt;br&gt;      BasicHttpBinding binding = &lt;span class="kwrd"&gt;new&lt;/span&gt; BasicHttpBinding();&lt;br&gt;      ServiceHost host = &lt;span class="kwrd"&gt;new&lt;/span&gt; ServiceHost(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(MyService), &lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(address));&lt;br&gt;      host.AddServiceEndpoint(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(IMyService), binding, &lt;span class="str"&gt;" "&lt;/span&gt;);&lt;br&gt;      host.Open();&lt;br&gt;      ChannelFactory&amp;lt;IMyService&amp;gt; factory = &lt;span class="kwrd"&gt;new&lt;/span&gt; ChannelFactory&amp;lt;IMyService&amp;gt;(binding);&lt;br&gt;      IMyService proxy = factory.CreateChannel(&lt;span class="kwrd"&gt;new&lt;/span&gt; EndpointAddress(address));&lt;br&gt;      Message response = proxy.Fail();&lt;br&gt;      Console.WriteLine(response.ToString());&lt;br&gt;      Console.ReadLine();&lt;br&gt;      host.Close();&lt;br&gt;   }&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;
That code produces a fault message that looks like the following.
&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;s:Envelope&lt;/span&gt; &lt;span class="attr"&gt;xmlns:s&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.xmlsoap.org/soap/envelope/"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;s:Header&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;s:Body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;s:Fault&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;faultcode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;s:Client&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;faultcode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;faultstring&lt;/span&gt; &lt;span class="attr"&gt;xml:lang&lt;/span&gt;&lt;span class="kwrd"&gt;="en-US"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;The creator of this fault did not specify a Reason.&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;faultstring&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;detail&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;tag&lt;/span&gt; &lt;span class="attr"&gt;attributeName&lt;/span&gt;&lt;span class="kwrd"&gt;="value"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;moretags&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;blah&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;moretags&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;tag&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;detail&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;s:Fault&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;s:Body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;s:Envelope&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;
Depending on how much hand-crafting you want, XmlDocument lets you simplify the process even further.  For example, you could generate the same message from simple XML completely put together by hand.
&lt;/p&gt;&lt;pre class="csharpcode"&gt;XmlDocument document = &lt;span class="kwrd"&gt;new&lt;/span&gt; XmlDocument();&lt;br&gt;document.LoadXml(&lt;span class="str"&gt;"&amp;lt;tag attributeName=\"value\"&amp;gt;&amp;lt;moretags&amp;gt;blah&amp;lt;/moretags&amp;gt;&amp;lt;/tag&amp;gt;"&lt;/span&gt;);&lt;br&gt;&lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; FaultException&amp;lt;XmlElement&amp;gt;(document.FirstChild &lt;span class="kwrd"&gt;as&lt;/span&gt; XmlElement);&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;
Next time: DataMember Best Practices
&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7814378" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=19502"&gt;</description><author>Nicholas Allens Indigo Blog</author><pubDate>2008-02-20T00:00:00</pubDate><category>XML/XSLT</category></item><item><title>HTML Agility Pack (Think Managed HTML DOM Parser, with XPath)</title><link>http://softlogger.com/18166/XML-XSLT/html-agility-pack-think-managed-html-dom-parser-with-xpath.aspx</link><description>&lt;p&gt;I came across the HTML Agility Pack while researching an issue I was having using the XMLReader to parse a HTML page...&lt;/p&gt; &lt;p&gt;The issue was that the HTML was not well formed (imagine that). So I needed a more forgiving HTML parser. I didn't want to falling back to the WebControl, COM or interop with MSHTML. I just wanted a "HTMLReader" or simple HTML DOM parser.&lt;/p&gt; &lt;p&gt;That's what lead me to the HTML Agility Pack...&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.codeplex.com"&gt;CodePlex&lt;/a&gt; - &lt;a href="http://www.codeplex.com/htmlagilitypack"&gt;HTML Agility Pack&lt;/a&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;"...&lt;/p&gt; &lt;p&gt;Now, erhh... &lt;b&gt;what is exactly the Html Agility Pack?&lt;/b&gt; All right, all right, I will tell you know:&lt;/p&gt; &lt;p&gt;This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don't HAVE to understand XPATH nor XSLT to use it, don't worry...). It is a .NET code library that allows you to parse "out of the web" HTML files. The parser is very tolerant with "real world" malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams).&lt;br&gt;Sample applications:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Page fixing or generation. You can fix a page the way you want, modify the DOM, add nodes, copy nodes, well... you name it.  &lt;li&gt;Web scanners. You can easily get to img/src or a/hrefs with a bunch XPATH queries.  &lt;li&gt;Web scrapers. You can easily scrap any existing web page into an RSS feed for example, with just an XSLT file serving as the binding. An example of this is provided. &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;br&gt;There is no dependency on anything else than .Net's XPATH implementation. There is no dependency on Internet Explorer's MSHTML dll or W3C's HTML tidy or ActiveX / COM object, or anything like that. There is also no adherence to XHTML or XML, although you can actually produce XML using the tool. ..."&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;With very little work I was able to rip out XMLReader and replace it with the HTML Agility Pack. And in the end, it let me write better code with fewer lines... And so far it's worked like a charm.&lt;/p&gt;  &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/coolthingoftheday?a=dRn5Y3D"&gt;&lt;img src="http://feeds.feedburner.com/~f/coolthingoftheday?i=dRn5Y3D" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/coolthingoftheday?a=ADnLoHD"&gt;&lt;img src="http://feeds.feedburner.com/~f/coolthingoftheday?i=ADnLoHD" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/coolthingoftheday?a=S8CXSVD"&gt;&lt;img src="http://feeds.feedburner.com/~f/coolthingoftheday?i=S8CXSVD" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/coolthingoftheday/~4/218947311" height="1" width="1"/&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=18166"&gt;</description><author>Gregs Cool [Insert Clever Name] of the Day</author><pubDate>2008-01-20T00:00:00</pubDate><category>XML/XSLT</category></item><item><title>Dynamically Producing XAML files using XamlWriter.Save Method</title><link>http://softlogger.com/18193/XML-XSLT/dynamically-producing-xaml-files-using-xamlwriter-save-method.aspx</link><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;The XamlWriter.Save is used to serialize the contents of a WPF application as a XAML file. I wrote a small sample in which we will be serializing the WPF objects to a XAML string&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; System;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; System.Collections.Generic;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; System.Linq;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; System.Text;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; System.Windows;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; System.Windows.Controls;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; System.IO;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; System.Windows.Data;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; System.Windows.Markup;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; System.Windows.Media;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;namespace&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; TestXAML&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Program&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;STAThread&lt;/SPAN&gt; ]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; &lt;?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /&gt;&lt;st1:place w:st="on"&gt;Main&lt;/st1:place&gt;(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;[] args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;[] arr = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;[5] ;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;arr[0]=1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;arr[1]=2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;arr[2]=3;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;arr[3]=4;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;arr[4]=5;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ListBox&lt;/SPAN&gt; objlst=&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ListBox&lt;/SPAN&gt;() ;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;objlst.ItemsSource = arr;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;objlst.Width = 200;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;StackPanel&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;MyStackPanel=&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;StackPanel&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;SolidColorBrush&lt;/SPAN&gt; brush = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;SolidColorBrush&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;brush.Color = &lt;SPAN style="COLOR: #2b91af"&gt;Color&lt;/SPAN&gt;.FromRgb(200, 100, 255);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;MyStackPanel.Background = brush;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;MyStackPanel.Children.Add(objlst);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; mystrXAML = &lt;SPAN style="COLOR: #2b91af"&gt;XamlWriter&lt;/SPAN&gt;.Save(MyStackPanel);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;FileStream&lt;/SPAN&gt; fs = &lt;SPAN style="COLOR: #2b91af"&gt;File&lt;/SPAN&gt;.Create(&lt;SPAN style="COLOR: #a31515"&gt;"testfile.xaml"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;StreamWriter&lt;/SPAN&gt; sw = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;StreamWriter&lt;/SPAN&gt;(fs);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;sw.Write(mystrXAML);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;sw.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;fs.Close(); &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7121349" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=18193"&gt;</description><author>Cool Stuff                                                                                          </author><pubDate>2008-01-15T00:00:00</pubDate><category>XML/XSLT</category></item><item><title>Building JavaScript Behaviors - 2</title><link>http://softlogger.com/16809/XML-XSLT/building-javascript-behaviors--2.aspx</link><description>&lt;p&gt;The sample from the last post about building JavaScript Behaviors is not very realistic, because it is not configurable and missing parameters.&lt;/p&gt;&lt;h3&gt;Properties, Attributes and Parameters&lt;/h3&gt;&lt;p&gt;The way parameters are passed to the behavior implementation is some kind of tricky:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;you write down a parameter into the *.aspx source file. &lt;li&gt;when the page is called from the server the parameter is passed to the server side control. &lt;li&gt;the parameter is then written out into the response (html) stream and send to the client. &lt;li&gt;when the behavior is attached to the html element it is made available to javascript. &lt;li&gt;the behavior implementation is using the parameter by using this.&lt;em&gt;parameter.&lt;/em&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;There are some traps and tricks on the way.&lt;/p&gt;&lt;p&gt;Take care of uppercase characters in the parameter name. Parameters with uppercase characters work fine on the server but using them on the client breaks the xhtml format spec. You can use lowercase parameters on the server and the client and you don't get confused when writing code for the server platform and the client platform the same time. &lt;/p&gt;&lt;p&gt;If you want to make a parameter available to the server control you have to add a public property or a public field to the class.&lt;/p&gt;&lt;p&gt;Using public fields is working fine but Visual Studio will not help with intellisense then so I prefer using a encapsulated private field using a public property:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; _datatype = String.Empty;

&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; datatype {
  &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt; { &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; _datatype; }
  &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt; { _datatype = &lt;span style="color:#0000ff;"&gt;value&lt;/span&gt;; }
} &lt;span style="color:#008000;"&gt;// datatype&lt;/span&gt;

&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; working_but_no_intellisense = String.Empty;&lt;/pre&gt;
&lt;p&gt;Passing null through a parameter just doesn't work because you cannot specify an attribute for a xml or html tag with a null value. I am using empty strings instead.&lt;/p&gt;
&lt;p&gt;If no attribute value is specified in the source code you need to define a default value. The easiest is to assign the default value to the private server field declaration and always render the attribute into the response stream.&lt;/p&gt;
&lt;p&gt;The firefox browser makes a big difference between attributes of a html element and a property of an object so when attaching a behavior to a html element all the attributes are copied into object properties.&lt;/p&gt;
&lt;p&gt;Don't use any reserved words you know from C#, VB.NET, JAVA, JavaScript, HTML or the DOM specification as a name and don't start a name with "on" because this naming convention is used for identifying event handlers.&lt;/p&gt;
&lt;h3&gt;1. Adding a parameter to the dice sample server control&lt;/h3&gt;
&lt;p&gt;The sample up to now is only showing random numbers from 1 to 6. A new parameter named "maxnumber" should make it possible to get random numbers between 1 and any positive number greater than 2.:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; _maxnumber = 6;

&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; maxnumber {
  &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt; { &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; _maxnumber; }
  &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt; { _maxnumber = &lt;span style="color:#0000ff;"&gt;value&lt;/span&gt;; }
} &lt;span style="color:#008000;"&gt;// maxnumber&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;This parameter is not needed on the server side and we just pass it to the client through a html attribute:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;div&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;=&lt;span style="color:#0000ff;"&gt;"&amp;lt;%=this.ClientID %&amp;gt;"&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;class&lt;/span&gt;=&lt;span style="color:#0000ff;"&gt;"Wuerfel"&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;maxnumber&lt;/span&gt;=&lt;span style="color:#0000ff;"&gt;"&amp;lt;%=this.maxnumber %&amp;gt;"&lt;/span&gt;
  &lt;span style="color:#ff0000;"&gt;unselectable&lt;/span&gt;=&lt;span style="color:#0000ff;"&gt;"on"&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;click&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;div&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;You can find this implementation in &lt;a href="http://www.mathertel.de/AJAXEngine/ViewSrc.aspx?file=~/S05_JSB/wuerfel2.ascx"&gt;wuerfel2.ascx&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;2. Adding a parameter to the behavior&lt;/h3&gt;
&lt;p&gt;On the client side we need to declare tha parameter as well. The given assignment will always be overwritten be the attribute the server adds to the html element.&lt;/p&gt;
&lt;p&gt;And then we must use.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:#008000;"&gt;// parameter to set the maximum number&lt;/span&gt;
maxnumber : 6,

&lt;span style="color:#008000;"&gt;// find a random number&lt;/span&gt;
&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; n = &lt;span style="color:#0000ff;"&gt;Math&lt;/span&gt;.floor(&lt;span style="color:#0000ff;"&gt;Math&lt;/span&gt;.random()*(&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.maxnumber-1))+1;&lt;/pre&gt;
&lt;p&gt;You can find this implementation in &lt;a href="http://www.mathertel.de/AJAXEngine/ViewSrc.aspx?file=~/S05_JSB/wuerfel2.js"&gt;wuerfel2.js&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;3. Using the new feature&lt;/h3&gt;
&lt;p&gt;Now the new parameter can be used on any wuerfel2 tag:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;uc1&lt;/span&gt;:&lt;span style="color:#ff0000;"&gt;Wuerfel2&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;ID&lt;/span&gt;=&lt;span style="color:#0000ff;"&gt;"Wuerfel2"&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;maxnumber&lt;/span&gt;=&lt;span style="color:#0000ff;"&gt;"42"&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;runat&lt;/span&gt;=&lt;span style="color:#0000ff;"&gt;"server"&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;You can find it in &lt;a href="http://www.mathertel.de/AJAXEngine/S05_JSB/Wuerfel_05.aspx"&gt;Wuerfel_05.aspx&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;You can download the updated files from &lt;a title="JSBTutorial zip file" href="http://www.mathertel.de/Downloads/Start_JSBTutorial.aspx"&gt;http://www.mathertel.de/Downloads/Start_JSBTutorial.aspx&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:afc9b2cf-7a08-44b6-9cfd-3b2c0707b50e" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;del.icio.us tags: &lt;a href="http://del.icio.us/popular/JavaScript" rel="tag"&gt;JavaScript&lt;/a&gt;, &lt;a href="http://del.icio.us/popular/behaviour" rel="tag"&gt;behaviour&lt;/a&gt;, &lt;a href="http://del.icio.us/popular/usercontrols" rel="tag"&gt;usercontrols&lt;/a&gt;&lt;/div&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=16809"&gt;</description><author>Aspects of AJAX</author><pubDate>2008-01-05T00:00:00</pubDate><category>XML/XSLT</category></item><item><title>Tree view Ajax control update</title><link>http://softlogger.com/16784/XML-XSLT/tree-view-ajax-control-update.aspx</link><description>&lt;p&gt;The tree view control was introduced some time ago and some details of its implementation can be found at &lt;a title="http://ajaxaspects.blogspot.com/2006/01/tree-view-ajax-control.html" href="http://ajaxaspects.blogspot.com/2006/01/tree-view-ajax-control.html"&gt;http://ajaxaspects.blogspot.com/2006/01/tree-view-ajax-control.html&lt;/a&gt;&amp;nbsp;or in the book at &lt;a title="Aspects of Ajax book" href="http://www.mathertel.de/AJAXEngine/documentation/AJAXeBook.aspx"&gt;http://www.mathertel.de/AJAXEngine/documentation/AJAXeBook.aspx&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Now there is an update available and also a step by step sample how to use this control inside your web application.&lt;/p&gt; &lt;p&gt;The sample page can be found at: &lt;a title="http://www.mathertel.de/AJAXEngine/S03_AJAXControls/TreeView.aspx" href="http://www.mathertel.de/AJAXEngine/S03_AJAXControls/TreeView.aspx"&gt;http://www.mathertel.de/AJAXEngine/S03_AJAXControls/TreeView.aspx&lt;/a&gt;.&lt;/p&gt; &lt;h3&gt;1. Building a web service&lt;/h3&gt; &lt;p&gt;Using Ajax with a tree view control is based on the idea that the full data that builds a complete tree might have a size that cannot be downloaded to the browser in one time. The server therefore has to offer a method that enables downloading&amp;nbsp;fragments of&amp;nbsp;a hierarchic data structure exactly in that moment when the user opens a new sub tree.&lt;/p&gt; &lt;p&gt;The tree view Ajax control binds to a webservice with only one function &lt;strong&gt;GetSubNodes&lt;/strong&gt;(string &lt;strong&gt;path&lt;/strong&gt;) that has to be built for your specific solution. If you like you can also use a different name for the method.&lt;/p&gt; &lt;p&gt;The structure of the XML node that must be returned by this method looks like this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;p&gt;&amp;lt;tree&amp;gt;
  &amp;lt;folder name="AK" title="Alaska"&amp;gt;&lt;br&gt;  &amp;lt;file title="Aguila" name="ZIP85320" link="http://weather.aol.com/main.adp?location=USAZ0001"/&amp;gt;
  &amp;lt;file title="Ajo" name="ZIP85920" /&amp;gt;&lt;br&gt;  &amp;lt;file name="Redmond" img="redfile" /&amp;gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;  &amp;lt;file name="Alpine" /&amp;gt;
  &amp;lt;file name="Yuma" /&amp;gt;
&amp;lt;/tree&amp;gt;&lt;/p&gt;&lt;/pre&gt;
&lt;p&gt;The outer element must be a &amp;lt;tree&amp;gt; node that contains &amp;lt;folder&amp;gt; and &amp;lt;file&amp;gt; nodes.&lt;/p&gt;
&lt;p&gt;As you can see the &lt;strong&gt;name &lt;/strong&gt;attributes do have a special&amp;nbsp;purpose in this structure&amp;nbsp;because the values of these nodes together and separated by slashes&amp;nbsp;will build a &lt;strong&gt;path&lt;/strong&gt; to each available element for example "/AZ/Ash Fork".&lt;/p&gt;
&lt;p&gt;When clicking onto folders and files this path will be used for loading&amp;nbsp;a subtree or for the events that are published when a final &amp;lt;file&amp;gt; node is clicked.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;title &lt;/strong&gt;attribute is optional. Its text will be displayed behind the icon. If it's not present the name will be used instead.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;link &lt;/strong&gt;attribute can be used when a click on a final node should just open a regular hyperlink.&lt;/p&gt;
&lt;p&gt;When there is no link present on&amp;nbsp;a file node an &lt;strong&gt;OpenAjax event&amp;nbsp;&lt;/strong&gt;"de.mathertel.treeview.click" with the path of the node in the data is published. You can register to this event for catch all clicks if no navigation is required.&lt;/p&gt;
&lt;p&gt;You can find a webservice implementation &lt;a href="http://localhost:1490/AJAXEngine/ViewSrc.aspx?file=~/S03_AJAXControls/TreeView.asmx"&gt;here&lt;/a&gt;&amp;nbsp;and &lt;a href="http://localhost:1490/AJAXEngine/ViewSrc.aspx?file=~/S03_AJAXControls/BibleData.asmx"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Having built such a web service most of the work is done. 
&lt;h3&gt;2. importing the webservice&lt;/h3&gt;
&lt;p&gt;The webservice must be made available on the page containing the Ajax tree view control by using a simple JavaScript include: &lt;/p&gt;&lt;pre class="code"&gt;&lt;p&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"text/javascript"&lt;/span&gt;&lt;br&gt;&lt;font style="background-color: #ffff99"&gt;   &lt;/font&gt;&lt;span style="color: #ff0000"&gt;src&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"../ajaxcore/GetJavaScriptProxy.aspx?service=../S03_AJAXControls/TreeView.asmx"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/pre&gt;
&lt;p&gt;Now the webservice is available through the proxies.TreeView object and the GetSubNodes method can be&amp;nbsp;called by using the generated proxies.TreeView.GetSubNodes() function.&lt;/p&gt;
&lt;h3&gt;3. embedding the Ajax tree view control&lt;/h3&gt;
&lt;p&gt;The control is implemented as a user control in the file ~/controls/TreeView.ascx. If you use Visual Studio 2005 you can drag this file onto a page and the control will be registered for this page or you can register the control by using a @Register tag at the beginning of the page:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;%@ Register Src="../controls/TreeView.ascx" TagName="TreeView" TagPrefix="ajax" %&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;The other way to register a user control is putting an option into the web.config file. This is the better solution if you want to reuse the control on multiple pages and like to use the same prefix all over the web application.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;configuration&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="color: #0000ff"&gt;  &amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;system.web&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="color: #0000ff"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;pages&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="color: #0000ff"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;controls&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; 
&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;add&lt;/span&gt; &lt;span style="color: #ff0000"&gt;src&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"~/controls/TreeView.ascx"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;tagName&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"TreeView"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;tagPrefix&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"ajax"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;The control itself can be used now:&amp;nbsp;&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;ajax&lt;/span&gt;:&lt;span style="color: #800000"&gt;TreeView&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"TreeView1"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt; &lt;br&gt;&amp;nbsp; &lt;span style="color: #ff0000"&gt;service&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"proxies.TreeView.GetSubNodes"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;title&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Cities in the USA"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;You can see&amp;nbsp;the complete source of the page by using this link: [&lt;a title="View Source" href="http://www.mathertel.de/AJAXEngine/ViewSrc.aspx?file=~/S03_AJAXControls/TreeView.aspx"&gt;view source of TreeView.aspx&lt;/a&gt;].&lt;/p&gt;
&lt;h3&gt;4. CSS and&amp;nbsp;specific icons&lt;/h3&gt;
&lt;p&gt;Some tree view might not only&amp;nbsp;use folders and files so there is a special feature for that too. 
&lt;p&gt;The CSS code that is used by the tree view control is shown here:&lt;/p&gt;&lt;pre class="code"&gt;div.TreeView .du {height:18px;overflow:hidden;cursor:hand; &lt;br&gt;&amp;nbsp; background-image:url(controls/images/dc.png);background-repeat:no-repeat}
div.TreeView .do {height:18px;overflow:hidden;cursor:hand;&lt;br&gt;&amp;nbsp; background-image:url(controls/images/do.png);background-repeat:no-repeat}
div.TreeView .dc {height:18px;overflow:hidden;cursor:hand;&lt;br&gt;&amp;nbsp; background-image:url(controls/images/dc.png);background-repeat:no-repeat}
div.TreeView .de {height:18px;overflow:hidden;&lt;br&gt;  background-image:url(controls/images/de.png);background-repeat:no-repeat}
div.TreeView .fl {height:18px;overflow:hidden;&lt;br&gt;  background-image:url(controls/images/file.png);background-repeat:no-repeat}
div.TreeView .ft {padding-left:40px}
div.TreeView .subframe {margin-left:18px;}&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Using these short classnames for attaching the style results in small html code fragments and you can link to the right images just by modifying the style rules. I put this baseline definition into the main css include file of the web application.&lt;/p&gt;
&lt;p&gt;By specifying the img attribute on a file node in the data that is returned from the server another classname can be included&amp;nbsp;for the ft-class elements. To avoid individual image tags in the tree view this classname extension also is handled by using a style rule that you can add:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt;.&lt;span style="color: #800000"&gt;TreeView&lt;/span&gt; .&lt;span style="color: #800000"&gt;fl&lt;/span&gt;.&lt;span style="color: #800000"&gt;redfile&lt;/span&gt; {&lt;span style="color: #ff0000"&gt;background-image&lt;/span&gt;:url(../controls/images/redfile.png)}&lt;/pre&gt;
&lt;p&gt;This definition can be found in the sample page itself but you can also put it into the mail css include file if you like. Search for Redmond(WA) to see it work.&lt;/p&gt;
&lt;h3&gt;5. handling the events&lt;/h3&gt;
&lt;p&gt;If you just like to show information in a tree fashion and like to use hyperlinks on the&amp;nbsp;file nodes&amp;nbsp;you don't need to have a look at the eventing system that is also built in.&lt;/p&gt;
&lt;p&gt;When clicking a&amp;nbsp;file node and if there is no hyperlink set then the tree view controls publishes an event that event handlers can catch. The eventing system that is used here is the &lt;a href="http://www.openajax.org/"&gt;OpenAjax&lt;/a&gt;&amp;nbsp;compatible event hub. You can find the documentation about it on the &lt;a href="http://www.OpenAjax.org"&gt;http://www.OpenAjax.org&lt;/a&gt; site and the implementation is part of the ~/controls/jcl.js file that is included automatically.&lt;/p&gt;
&lt;p&gt;To register for such an event you need a little bit of JavaScript code:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: #008000"&gt;// a function that will catch the tree events by listening to de.mathertel.treeview.**.&lt;/span&gt;
&lt;span style="color: #0000ff"&gt;function&lt;/span&gt; showTreeEvent(&lt;span style="color: #0000ff"&gt;name&lt;/span&gt;, data) {
  &lt;span style="color: #0000ff"&gt;alert&lt;/span&gt;("&lt;span style="color: #8b0000"&gt;click on &lt;/span&gt;" + data);
} &lt;span style="color: #008000"&gt;// showTreeEvent&lt;/span&gt;

OpenAjax.hub.subscribe("&lt;span style="color: #8b0000"&gt;de.mathertel.treeview.**&lt;/span&gt;", showTreeEvent);&lt;/pre&gt;
&lt;p&gt;The OpenAjax.hub.subscribe is registering the showTreeEvent function and this function will be passed the name of the event and the path in the data payload.&lt;/p&gt;
&lt;h3&gt;About the updated features&lt;/h3&gt;
&lt;p&gt;New to the current implementation is the support for the link attribute in the &amp;lt;file&amp;gt; elements and the publishing of events when clicking final nodes.&lt;/p&gt;
&lt;p&gt;If you want to see&amp;nbsp;more features or want to have more supported scenarios then let me know by using the&amp;nbsp;feature request function on &lt;a title="http://sourceforge.net/projects/ajaxengine/" href="http://sourceforge.net/projects/ajaxengine/"&gt;http://sourceforge.net/projects/ajaxengine/&lt;/a&gt;.&lt;/p&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=16784"&gt;</description><author>Aspects of AJAX</author><pubDate>2008-01-05T00:00:00</pubDate><category>XML/XSLT</category></item><item><title>Get a Real XML Parser</title><link>http://softlogger.com/16198/XML-XSLT/get-a-real-xml-parser.aspx</link><description>&lt;p&gt;
Today's post is more observational than informational.  Enjoy.
&lt;/p&gt;&lt;p&gt;
It's sometimes possible to write XML without having an XML library.  If your XML documents are sufficiently similar and templated, then you can craft validly formed XML through little more than string manipulation.  The trivial case is where the string is a constant expression and the XML document is actually the same every time through.  The more interesting case is where the string has many spots where you can fill-in-the-blank with arbitrary content.  Once that content becomes constrained instead of arbitrary, you'll almost always want to make use of an XML library assuming that you want your emitted messages to be validated.
&lt;/p&gt;&lt;p&gt;
It's pretty much impossible to read XML without having an XML library.  XML simply has too many rules about whitespace handling, processing instructions, character formats, and nested elements to realistically build hand-crafted parsers in an application.  A hand-crafted parser likely supports exactly the message that you saw one day looking at the wire but contains numerous bugs that prevent all of the equivalent ways of writing the same message from being accepted.  Even seemingly unimportant changes to the network configuration can result in literal changes, such as the text encoding or the division of text into text nodes expected by a DOM.  If you want to understand XML, then you'll need to get a real XML parser.  Using an XML parser instead of string manipulation is more expensive but if you can't afford this cost, then you probably can't afford the benefits that XML provides either.
&lt;/p&gt;&lt;p&gt;
Next time: &lt;a href="http://blogs.msdn.com/drnick/archive/2008/01/04/accessing-the-query-string.aspx" mce_href="http://blogs.msdn.com/drnick/archive/2008/01/04/accessing-the-query-string.aspx"&gt;Accessing the Query String&lt;/a&gt;
&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6964428" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=16198"&gt;</description><author>Nicholas Allens Indigo Blog</author><pubDate>2008-01-03T00:00:00</pubDate><category>XML/XSLT</category></item><item><title>Linq to XML code samples</title><link>http://softlogger.com/13853/XML-XSLT/linq-to-xml-code-samples.aspx</link><description>&lt;P&gt;Well, that didn't take long: Eric White has already posted a &lt;A href="http://blogs.msdn.com/ericwhite/archive/2007/12/11/Using-LINQ-to-XML-with-Open-XML-Documents.aspx" mce_href="http://blogs.msdn.com/ericwhite/archive/2007/12/11/Using-LINQ-to-XML-with-Open-XML-Documents.aspx"&gt;series of blog posts&lt;/A&gt; on using Linq to XML with Open XML. He covers the basics of packages and parts, and then presents an OpenXMLDocument class that converts any Open XML document into a hierarchical object graph on which it is easy to write LINQ to XML queries. An XDocument XML is created for each part in the package, and you can then write LINQ to XML queries over multiple parts easily. &lt;/P&gt;
&lt;P&gt;From the comment thread on Eric's blog, I learned that James Newton-King has also posted a &lt;A href="http://james.newtonking.com/archive/2007/12/11/linq-to-xml-over-large-documents.aspx" mce_href="http://james.newtonking.com/archive/2007/12/11/linq-to-xml-over-large-documents.aspx"&gt;Ling to XML sample&lt;/A&gt; for Open XML development. An idea whose time has come, apparently! &lt;/P&gt;
&lt;P&gt;James's &lt;A href="http://james.newtonking.com/archive/2007/12/11/linq-to-xml-over-large-documents.aspx" mce_href="http://james.newtonking.com/archive/2007/12/11/linq-to-xml-over-large-documents.aspx"&gt;"Linq to XML over large documents post"&lt;/A&gt; focuses more on the performance aspects of Linq to XML, and how it provides for a smaller memory footprint than a DOM-based approach. He describes how you can combine Linq to XML with XMLReader to get the best of both worlds: flexible and simple development, and minimal memory usage resulting in great performance. &lt;/P&gt;
&lt;P&gt;If you're interested in learning a lot more abobut how Linq to XML can help streamline your Open XML development work, be sure to add these two blogs to your RSS feeds: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/ericwhite/rss.xmlhttp://feeds.feedburner.com/jamesnewtonking"&gt;Eric White - RSS feed&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://feeds.feedburner.com/jamesnewtonking"&gt;James Newton-King - RSS feed&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6735740" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=13853"&gt;</description><author>Doug Mahugh</author><pubDate>2007-12-11T00:00:00</pubDate><category>XML/XSLT</category></item><item><title>Resolving Conflicts in Serialization</title><link>http://softlogger.com/13971/XML-XSLT/resolving-conflicts-in-serialization.aspx</link><description>&lt;p&gt;&lt;i&gt;
DataContractSerializer supports multiple serialization mechanisms.  If more than one serialization mechanism is specified for the same type, which one gets used?&lt;/i&gt;
&lt;/p&gt;&lt;p&gt;
Experimentation is the easiest way to figure out what happens.  I'll look at different combinations of the XML serializer, the data contract serializer, and the "collection-based" data contract serializer, which is the default mechanism for the concrete collection classes.
&lt;/p&gt;&lt;p&gt;
Let's start with a base interface that defines a member for the type.
&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IFoo&lt;br&gt;{&lt;br&gt;   &lt;span class="kwrd"&gt;string&lt;/span&gt; data { get; set; }&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;
Now, let's apply various combinations of serialization mechanisms to implementations of the base interface.  I'll start with each of the serializers by themselves and then each of the legal combinations.  Data contracts and collection data contracts can't be used at the same time so that pairing isn't possible as well as trying to use all three serialization mechanisms at once.
&lt;/p&gt;&lt;p&gt;
Here's a quick test program to run through the combinations.
&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;br&gt;{&lt;br&gt;   [DataContract]&lt;br&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; FooDataContract : IFoo&lt;br&gt;   {&lt;br&gt;      [DataMember]&lt;br&gt;      &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; data { get; set; }&lt;br&gt;   }&lt;br&gt;&lt;br&gt;   [Serializable]&lt;br&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; FooSerializable : IFoo&lt;br&gt;   {&lt;br&gt;      &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; data { get; set; }&lt;br&gt;   }&lt;br&gt;&lt;br&gt;   [CollectionDataContract]&lt;br&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; FooCollection : List&amp;lt;&lt;span class="kwrd"&gt;int&lt;/span&gt;&amp;gt;, IFoo&lt;br&gt;   {&lt;br&gt;      [DataMember]&lt;br&gt;      &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; data { get; set; }&lt;br&gt;   }&lt;br&gt;&lt;br&gt;   [Serializable]&lt;br&gt;   [DataContract]&lt;br&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; FooSerializableDataContract : IFoo&lt;br&gt;   {&lt;br&gt;      [DataMember]&lt;br&gt;      &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; data { get; set; }&lt;br&gt;   }&lt;br&gt;&lt;br&gt;   [Serializable]&lt;br&gt;   [CollectionDataContract]&lt;br&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; FooSerializableCollection : List&amp;lt;&lt;span class="kwrd"&gt;int&lt;/span&gt;&amp;gt;, IFoo&lt;br&gt;   {&lt;br&gt;      [DataMember]&lt;br&gt;      &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; data { get; set; }&lt;br&gt;   }&lt;br&gt;&lt;br&gt;   &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;br&gt;   {&lt;br&gt;      &lt;span class="kwrd"&gt;using&lt;/span&gt; (XmlTextWriter writer = &lt;span class="kwrd"&gt;new&lt;/span&gt; XmlTextWriter(Console.Out))&lt;br&gt;      {&lt;br&gt;         &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Type type &lt;span class="kwrd"&gt;in&lt;/span&gt; &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(Program).GetNestedTypes())&lt;br&gt;         {&lt;br&gt;            IFoo foo = (IFoo)type.InvokeMember(&lt;span class="kwrd"&gt;null&lt;/span&gt;, BindingFlags.CreateInstance, &lt;span class="kwrd"&gt;null&lt;/span&gt;, &lt;span class="kwrd"&gt;null&lt;/span&gt;, &lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;br&gt;            foo.data = type.Name;&lt;br&gt;            DataContractSerializer serializer = &lt;span class="kwrd"&gt;new&lt;/span&gt; DataContractSerializer(type);&lt;br&gt;            writer.WriteString(type.Name);&lt;br&gt;            writer.WriteWhitespace(&lt;span class="str"&gt;"\n"&lt;/span&gt;);&lt;br&gt;            serializer.WriteObject(writer, foo);&lt;br&gt;            writer.WriteWhitespace(&lt;span class="str"&gt;"\n\n"&lt;/span&gt;);&lt;br&gt;         }&lt;br&gt;      }&lt;br&gt;      Console.ReadLine();&lt;br&gt;   }&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;
That gives us a set of outputs to inspect to see what serializer won.
&lt;/p&gt;&lt;p&gt;&lt;b&gt;
FooDataContract&lt;/b&gt;
&lt;/p&gt;&lt;p&gt;
&amp;lt;Program.FooDataContract xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/"&amp;gt;&amp;lt;&lt;span class="kwrd"&gt;data&lt;/span&gt;&amp;gt;FooDataContract&amp;lt;/&lt;span class="kwrd"&gt;data&lt;/span&gt;&amp;gt;&amp;lt;/Program.FooDataContract&amp;gt;
&lt;/p&gt;&lt;p&gt;&lt;b&gt;
FooSerializable&lt;/b&gt;
&lt;/p&gt;&lt;p&gt;
&amp;lt;Program.FooSerializable xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/"&amp;gt;&amp;lt;_x003C_data_x003E_k__BackingField&amp;gt;FooSerializable&amp;lt;/_x003C_data_x003E_k__BackingField&amp;gt;&amp;lt;/Program.FooSerializable&amp;gt;
&lt;/p&gt;&lt;p&gt;&lt;b&gt;
FooCollection&lt;/b&gt;
&lt;/p&gt;&lt;p&gt;
&amp;lt;Program.FooCollection xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/" /&amp;gt;
&lt;/p&gt;&lt;p&gt;&lt;b&gt;
FooSerializableDataContract&lt;/b&gt;
&lt;/p&gt;&lt;p&gt;
&amp;lt;Program.FooSerializableDataContract xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/"&amp;gt;&amp;lt;&lt;span class="kwrd"&gt;data&lt;/span&gt;&amp;gt;FooSerializableDataContract&amp;lt;/&lt;span class="kwrd"&gt;data&lt;/span&gt;&amp;gt;&amp;lt;/Program.FooSerializableDataContract&amp;gt;
&lt;/p&gt;&lt;p&gt;&lt;b&gt;
FooSerializableCollection&lt;/b&gt;
&lt;/p&gt;&lt;p&gt;
&amp;lt;Program.FooSerializableCollection xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/" /&amp;gt;
&lt;/p&gt;&lt;ul&gt;&lt;li&gt;FooDataContract gave us the data member with the nice format for properties.
&lt;/li&gt;&lt;li&gt;
FooSerializable gave us the data member with the ugly format for properties.
&lt;/li&gt;&lt;li&gt;
FooCollection failed to give us the data member (CollectionDataContract doesn't let you have non-default members).
&lt;/li&gt;&lt;li&gt;
FooSerializableDataContract is the same as FooDataContract.  DataContract beats Serializable.
&lt;/li&gt;&lt;li&gt;
FooSerializableCollection is the same as FooCollection.  CollectionDataContract beats Serializable as well.
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
Next time: TCP Keep Alive
&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6733321" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=13971"&gt;</description><author>Nicholas Allens Indigo Blog</author><pubDate>2007-12-11T00:00:00</pubDate><category>XML/XSLT</category></item><item><title>Use the provider model in ASP.NET 2.0</title><link>http://softlogger.com/13760/XML-XSLT/use-the-provider-model-in-asp-net-2-0.aspx</link><description>&lt;p&gt;
I think by now, most ASP.NET developers have come across some of the different provider models in ASP.NET 2.0. Most likely the &lt;a href="http://msdn2.microsoft.com/en-us/library/aa478949.aspx"&gt;Membership&lt;/a&gt;, &lt;a href="http://msdn2.microsoft.com/en-us/library/aa478950.aspx"&gt;Roles&lt;/a&gt; and &lt;a href="http://msdn2.microsoft.com/en-us/library/aa478951.aspx"&gt;SiteMap&lt;/a&gt; provider but also the custom provider model that you can use to create your own providers. 
&lt;/p&gt;
&lt;p&gt;
Still, I often come across custom authentication and authorization mechanisms instead of using the Membership and Roles provider model. Typically, a business object called &lt;em&gt;User&lt;/em&gt; has a &lt;em&gt;Logon&lt;/em&gt; method that does the authentication and returns a Boolean back to the login page, which sets a cookie and maybe session variable and then redirects the user to the password protected area of the website. 
&lt;/p&gt;
&lt;p&gt;
Then there&amp;rsquo;s usual also some custom authorization mechanism that prevents certain logged in users from certain areas such as admin pages. The menu is custom designed to hide and show only the pages available to the current user and the individual pages also makes the checks. 
&lt;/p&gt;
&lt;p&gt;
That is a common scenario and I see it very often. If you have such a scenario on your web application, then consider converting your existing logic to use the provider model. By creating a custom implementation of the Membership, Roles and SiteMap provider, you get all this for free and it is very simple to do so. You can keep your existing code and then build the providers on top of that. 
&lt;/p&gt;
&lt;p&gt;
The benefit is that these three providers work together so that the SiteMap automatically shows only the pages a user has permissions to see based on her role. You also get the cookie management for free. But the best part is that you can easily switch to a new provider when needed without changing your existing code. I did that today when I installed BlogEngine.NET on our intranet at &lt;a href="https://zyb.com"&gt;ZYB&lt;/a&gt;. It had to use the Active Directory Membership provider so that we could log on using our network credentials. It took me 5 minutes to make the transition from my custom &lt;a href="http://blog.madskristensen.dk/post.aspx?id=4968bd4b-c1ac-4955-9ecc-bd7689538523"&gt;XML Membership provider&lt;/a&gt; to the Active Directory one. There&amp;rsquo;s a good &lt;a href="http://msdn2.microsoft.com/en-us/library/ms998360.aspx"&gt;guide at MSDN&lt;/a&gt; for using the Active Directory provider. 
&lt;/p&gt;
&lt;p&gt;
That flexibility comes free of charge with ASP.NET 2.0 and makes the lives of all .NET web developers much easier, more flexible and powerful. I have published my &lt;a href="http://blog.madskristensen.dk/post.aspx?id=4968bd4b-c1ac-4955-9ecc-bd7689538523"&gt;XML Membership provider&lt;/a&gt; and will wrap up the XML Roles provider soon and publish it as well. 
&lt;/p&gt;
&lt;p&gt;
When you first try the provider model, I promise that you&amp;rsquo;ll never go back. 
&lt;/p&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;ul&gt;
	&lt;li&gt;
	&lt;div&gt;
	&lt;a href="http://www.asp.net/learn/videos/video-189.aspx"&gt;Video: Create a Custom Membership Provider&lt;/a&gt; 
	&lt;/div&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;div&gt;
	&lt;a href="http://msdn2.microsoft.com/en-us/library/317sza4k.aspx"&gt;Sample Role provider implementation&lt;/a&gt; 
	&lt;/div&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;div&gt;
	&lt;a href="http://www.odetocode.com/Articles/427.aspx"&gt;Membership and Role providers in ASP.NET 2.0&lt;/a&gt;
	&lt;/div&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;div&gt;
	&lt;a href="http://aspnet.4guysfromrolla.com/articles/111605-1.aspx"&gt;Examining ASP.NET 2.0&amp;#39;s Site Navigation&lt;/a&gt; 
	&lt;/div&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;div&gt;
	&lt;a href="http://blogs.ugidotnet.org/luka/archive/2005/11/30/30800.aspx"&gt;SiteMap provider introduction&lt;/a&gt;
	&lt;/div&gt;
	&lt;/li&gt;
&lt;/ul&gt;
&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=13760"&gt;</description><author>.NET slave</author><pubDate>2007-12-10T00:00:00</pubDate><category>XML/XSLT</category></item><item><title>Cross Site Scripting Joy: XSS in detail</title><link>http://softlogger.com/13489/XML-XSLT/cross-site-scripting-joy-xss-in-detail.aspx</link><description>	&lt;p&gt;In &lt;a href="http://cometdaily.com/2007/12/04/cross-site-scripting-joy/"&gt;Cross Site Scripting Joy&lt;/a&gt;, Andrew Betts has taken the time to go into real detail on XSS and the fun and frolics that we have with the Same Origin Policy and beyond:&lt;/p&gt;
	&lt;blockquote&gt;
	&lt;p&gt;So the battle over XSS as a security problem has moved on from the same origin policy, but same origin remains a massive obstacle to development of useful non-malicious services, and that’s particularly true of Comet, because there are typically two servers involved in any comet setup: a web server like Apache, and a comet server like Meteor or Orbited.&lt;/p&gt;
	&lt;p&gt;There are essentially three choices for making these two servers play together:&lt;/p&gt;
	&lt;ol&gt;
	&lt;li&gt;marry them: have one server that serves both your Comet connections and the standard ones (including any dynamically generated content);&lt;/li&gt;
	&lt;li&gt;have a regular web server with a Comet server sitting in front of it, so all connections are made to the Comet server, and it proxies the non-comet connections to the web server;&lt;/li&gt;
	&lt;li&gt;have both the Comet and the regular web server exposed to the web, and request applicable content from each one.&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/blockquote&gt;
	&lt;p&gt;Andrew then decided to &lt;a href="http://meteorserver.org/browser-techniques/xssinfo"&gt;write a bunch of tests&lt;/a&gt; (38 in fact) to see how the SOP is implemented in various browsers, and ended up with the following thorough information:&lt;/p&gt;
	&lt;p&gt;&lt;a href="http://meteorserver.org/browser-techniques/xssinfo"&gt;&lt;img src="http://ajaxian.com/wp-content/images/xsstests.png" alt="XSS Tests" border="0" width="557" height="970"/&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/ajaxian?a=52EPjwC"&gt;&lt;img src="http://feeds.feedburner.com/~f/ajaxian?i=52EPjwC" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/ajaxian?a=WMMHRxC"&gt;&lt;img src="http://feeds.feedburner.com/~f/ajaxian?i=WMMHRxC" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/ajaxian?a=ghQLYrc"&gt;&lt;img src="http://feeds.feedburner.com/~f/ajaxian?i=ghQLYrc" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=13489"&gt;</description><author>Ajaxian</author><pubDate>2007-12-05T00:00:00</pubDate><category>XML/XSLT</category></item><item><title>Create your own media browser: Display your pictures, music, movies in a XAML tooltip</title><link>http://softlogger.com/13003/XML-XSLT/create-your-own-media-browser-display-your-pictures-music-movies-in-a-xaml-tooltip.aspx</link><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;In my &lt;A href="http://blogs.msdn.com/calvin_hsia/archive/2007/11/28/6583391.aspx"&gt;&lt;FONT color=#800080&gt;prior post&lt;/FONT&gt;&lt;/A&gt;, I showed how to use XAML and XAMLReader to create inline XAML to display the results of a query.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Today, let's take it a step further: let's create a query of all the media (pictures, movies, music) in your "My Documents" folder and display the names and sizes in a ListView. As you navigate the list, a tooltip appears showing the media. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;You can click on the tip and move it around the screen, or you can mousewheel to zoom in and out.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The code illustrates how to use inline XAML to create hierarchies of UI Elements and get references to those objects to add event handlers. It also shows how to create a databinding &lt;A href="http://msdn2.microsoft.com/en-us/library/ms745683.aspx#styling_datatemplates"&gt;DataTemplate&lt;/A&gt; and &lt;A href="http://msdn2.microsoft.com/en-us/library/ms745683.aspx"&gt;&lt;FONT color=#800080&gt;Style&lt;/FONT&gt;&lt;/A&gt; with inline XAML. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;To get your Foxpro database pictures into this code, see&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://blogs.msdn.com/calvin_hsia/archive/2006/08/18/706679.aspx"&gt;&lt;FONT color=#800080&gt;Various ways to display multiple photographs&lt;/FONT&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: 342.35pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;Start Visual Studio 2008&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: 342.35pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: 342.35pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;Choose File-&amp;gt;New Project-&amp;gt;Visual Basic-&amp;gt;WPF Application&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: 342.35pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;You can use the WPF Forms designer, or you can write your code in a program.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: 342.35pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: 342.35pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;Double click the form designer to bring up the Window1.xaml.vb file. Replace the contents with the code below.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: 342.35pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;Hit F5 to run the program&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: 342.35pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: 342.35pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;The query scans your "My Documents" folder for various file types. You can change those types in the query.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: 342.35pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: 342.35pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: 342.35pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: EN"&gt;&amp;lt;Sample Code&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" color=blue size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Imports&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; System.Windows.Controls.Primitives&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=green&gt;&lt;SPAN style="COLOR: green"&gt;' for Popup&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" color=blue size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Partial&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Public&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Class&lt;/SPAN&gt;&lt;/FONT&gt; Window1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt;&lt;/FONT&gt; _rootFolder &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;String&lt;/SPAN&gt;&lt;/FONT&gt; = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Private&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Sub&lt;/SPAN&gt;&lt;/FONT&gt; Window1_Loaded(&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;ByVal&lt;/SPAN&gt;&lt;/FONT&gt; sender &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; System.Object, &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;ByVal&lt;/SPAN&gt;&lt;/FONT&gt; e &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; System.Windows.RoutedEventArgs) &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Handles&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;MyBase&lt;/SPAN&gt;&lt;/FONT&gt;.Loaded&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Me&lt;/SPAN&gt;&lt;/FONT&gt;.Width = 800 : &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Me&lt;/SPAN&gt;&lt;/FONT&gt;.Height = 800&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt;&lt;/FONT&gt; Query = &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;From&lt;/SPAN&gt;&lt;/FONT&gt; file &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;In&lt;/SPAN&gt;&lt;/FONT&gt; IO.Directory.GetFiles(_rootFolder, _&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=#a31515&gt;&lt;SPAN style="COLOR: #a31515"&gt;"*.*"&lt;/SPAN&gt;&lt;/FONT&gt;, IO.SearchOption.AllDirectories) _&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Select&lt;/SPAN&gt;&lt;/FONT&gt; file, Ext = IO.Path.GetExtension(file).ToLower _&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Where&lt;/SPAN&gt;&lt;/FONT&gt; Ext.Length &amp;gt; 0 &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;AndAlso&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=#a31515&gt;&lt;SPAN style="COLOR: #a31515"&gt;".avi .jpg .mid .mpg .wma .wmv"&lt;/SPAN&gt;&lt;/FONT&gt;.Contains(Ext) _&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Select&lt;/SPAN&gt;&lt;/FONT&gt; FileName = file.Substring(_rootFolder.Length + 1), _&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Type = Ext.Substring(1), _&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Size = (&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt;&lt;/FONT&gt; IO.FileInfo(file)).Length&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Me&lt;/SPAN&gt;&lt;/FONT&gt;.Content = &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt;&lt;/FONT&gt; BrowseWithMedia(Query, &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Me&lt;/SPAN&gt;&lt;/FONT&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Me&lt;/SPAN&gt;&lt;/FONT&gt;.Title = _rootFolder + &lt;FONT color=#a31515&gt;&lt;SPAN style="COLOR: #a31515"&gt;" #Items = "&lt;/SPAN&gt;&lt;/FONT&gt; + _&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;CType&lt;/SPAN&gt;&lt;/FONT&gt;(&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Me&lt;/SPAN&gt;&lt;/FONT&gt;.Content, BrowseWithMedia).Items.Count.ToString&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;End&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Private&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Sub&lt;/SPAN&gt;&lt;/FONT&gt; Window1_Deactivated(&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;ByVal&lt;/SPAN&gt;&lt;/FONT&gt; sender &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Object&lt;/SPAN&gt;&lt;/FONT&gt;, &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;ByVal&lt;/SPAN&gt;&lt;/FONT&gt; e &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; System.EventArgs) &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Handles&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Me&lt;/SPAN&gt;&lt;/FONT&gt;.Deactivated&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt;&lt;/FONT&gt; pop = &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;CType&lt;/SPAN&gt;&lt;/FONT&gt;(&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Me&lt;/SPAN&gt;&lt;/FONT&gt;.Content, BrowseWithMedia)._lvPopUp &lt;FONT color=green&gt;&lt;SPAN style="COLOR: green"&gt;' no popup if user changes active window (Alt-Tab)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;If&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Not&lt;/SPAN&gt;&lt;/FONT&gt; pop &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Is&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Nothing&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;AndAlso&lt;/SPAN&gt;&lt;/FONT&gt; pop.IsOpen &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Then&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;pop.IsOpen = &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;False&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;End&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;If&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;End&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Private&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Class&lt;/SPAN&gt;&lt;/FONT&gt; BrowseWithMedia : &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Inherits&lt;/SPAN&gt;&lt;/FONT&gt; Browse&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt;&lt;/FONT&gt; _Parent &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; Window1&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=green&gt;&lt;SPAN style="COLOR: green"&gt;' reference to container&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Friend&lt;/SPAN&gt;&lt;/FONT&gt; _lvPopUp &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; Popup&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=green&gt;&lt;SPAN style="COLOR: green"&gt;' popup window to show tip with movie&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;WithEvents&lt;/SPAN&gt;&lt;/FONT&gt; _lvTimer &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt;&lt;/FONT&gt; System.Windows.Threading.DispatcherTimer &lt;FONT color=green&gt;&lt;SPAN style="COLOR: green"&gt;' timer: after delay, show tip&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Sub&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt;&lt;/FONT&gt;(&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;ByVal&lt;/SPAN&gt;&lt;/FONT&gt; Query &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Object&lt;/SPAN&gt;&lt;/FONT&gt;, &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Optional&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;ByVal&lt;/SPAN&gt;&lt;/FONT&gt; Parent &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Object&lt;/SPAN&gt;&lt;/FONT&gt; = &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Nothing&lt;/SPAN&gt;&lt;/FONT&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;MyBase&lt;/SPAN&gt;&lt;/FONT&gt;.new(Query, Parent)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_Parent = Parent&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;End&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Sub&lt;/SPAN&gt;&lt;/FONT&gt; HandleWheel(&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;ByVal&lt;/SPAN&gt;&lt;/FONT&gt; sp &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; StackPanel, &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;ByVal&lt;/SPAN&gt;&lt;/FONT&gt; e &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; System.Windows.Input.MouseWheelEventArgs) &lt;FONT color=green&gt;&lt;SPAN style="COLOR: green"&gt;'Handles Me.MouseWheel&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=blue size=2&gt;&lt;SPAN lang=FR style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: FR"&gt;Dim&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN lang=FR style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: FR"&gt; transform = &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;CType&lt;/SPAN&gt;&lt;/FONT&gt;(sp.RenderTransform, ScaleTransform)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN lang=FR style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: FR"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=blue size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Dim&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; melem &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; MediaElement = sp.Children(1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;If&lt;/SPAN&gt;&lt;/FONT&gt; e.Delta &amp;gt; 0 &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Then&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;melem.Height *= 1.1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;melem.Width *= 1.1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=green&gt;&lt;SPAN style="COLOR: green"&gt;'transform.ScaleX *= 1.1&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;' to scale tip text too&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=green&gt;&lt;SPAN style="COLOR: green"&gt;'transform.ScaleY *= 1.1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Else&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=green&gt;&lt;SPAN style="COLOR: green"&gt;'transform.ScaleX /= 1.1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color=green&gt;&lt;SPAN style="COLOR: green"&gt;'transform.ScaleY /= 1.1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;melem.Height /= 1.1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;melem.Width /= 1.1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;End&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;If&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;End&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt;&lt;/FONT&gt; _mdownPt &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; Point&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Sub&lt;/SPAN&gt;&lt;/FONT&gt; HandleClick(&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;ByVal&lt;/SPAN&gt;&lt;/FONT&gt; sp &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; StackPanel, &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;ByVal&lt;/SPAN&gt;&lt;/FONT&gt; e &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; MouseButtonEventArgs)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;If&lt;/SPAN&gt;&lt;/FONT&gt; sp.IsMouseCaptured &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Then&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;sp.ReleaseMouseCapture()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;End&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;If&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;If&lt;/SPAN&gt;&lt;/FONT&gt; e.LeftButton = MouseButtonState.Pressed &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Then&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_mdownPt = Mouse.GetPosition(sp)&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=green&gt;&lt;SPAN style="COLOR: green"&gt;' record mouse pos relative to sp&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;sp.CaptureMouse()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;End&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;If&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;End&lt;/SPAN&gt;&lt;/FONT&gt; &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;Sub&lt;/SPAN&gt;&lt;/FONT&gt; HandleMouseMove(&lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;ByVal&lt;/SPAN&gt;&lt;/FONT&gt; sp &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt;&lt;/FONT&gt; StackPanel, &lt;FONT color=blue&gt;&lt;SPAN style="COLOR: blue"&gt