• « Big Win. Interesting Product. Is hardware acceleration the answer?
    • |
    • Main
    • |
    • Pics of a steaming Mt. St. Helens, w/ Rainier and Adams to boot »
            • November 30, 2004

              XAML, VS XAML Viewer, and XSL...

            • VS XAML Viewer Updated

              ** <COMMENT-MDP>' ** Please read all the way down, or at very least scroll there now if you dont want to read all this code. Gaston has left the door open for desingers to jump in and develop something other than what he has as his base XSL Transformation file. I've bolded the XSL related portions of this post.
              ** </COMMENT-MDP> **

              * In general Refresh is not needed anymore; I’m parsing when the XAML tab page is activated.
              * Rob told me that the viewer could not parse some valid files (for example when the XAML file had codebehind). He helped me with a solution for that so that this is working now. Thanks Rob
              * Chris Sells suggested add the Visual Tree to the viewer and he pointed to this post that shows how to do the work. I accepted the suggestion and I had implemented this feature in this way:

              o I changed the base code in this way:

              public static class VisualUtility

              {

              public static void GetVisualTreeInfo(Visual element, XmlWriter writer)

              {

              if (element == null)

              {

              throw new ArgumentNullException("element");

              }

              writer.WriteStartElement("VisualElement");

              writer.WriteElementString("Type", element.GetType().ToString());

              VisualCollection vc = VisualOperations.GetChildren(element);

              if (vc != null && vc.Count > 0)

              {

              foreach (Visual v in vc)

              {

              GetVisualTreeInfo(v, writer);

              }

              }

              writer.WriteEndElement();

              }

              }

              o The difference is that this code write the visual tree in XML.
              o I was thinking in read this XML and show it a tree view (winform), but I’m learning XAML now!! So I decided to use a XSL in order to generate XAML.

              When the visual tree tab is selected the XML is generated and after that the visualtree.xsl is applied in order to get a XAML (in a MemoryStream) and then load this XAML in the tab page. (the tab page has a ElementHost in order to show XAML inside a windows form)

              I’m not a graphic designer so I hope that somebody modify my initial visualtree.xsl (it is in the installation folder) to get a better XAML for the Visual Tree. Now it is just a XAML Table.

              ---

              Ummmmm.... thats sounds like a tempting offer! Hmmm... Well, if anybody else would like to take Gaston up on this please do so. If at the end of the day my task list is complete and no offers have been made to make this stylesheet the phattest little stylesheet Visual Studio has ever seen then I may just have to jump in on this one... none-the-less, if you have the cycles today and what to get some recognition from the folks in Redmond, this would be a GREAT opportunity to do so... In fact, what am I thinking... the more styles the merrier folks... HAVE AT IT!!!! :D Please let me know if you do submit a new stylesheet to Gaston so I can make sure it gets blogged.
              ___

              What brings me to near tears of joy is the recognition to the fact that instead of using .NET's XML editing API's Gaston, without even a hesitation, realized that he needed to be using a XSL stylesheet for this tool and as such created one and made it the focus of this application to render the XAML within the code viewer.

              For you Visual Studio developers (don't be ashamed, I use it too... ;) this seems like a nice little addin for viewing your XAML base in Markup, Text, and as a Tree View. Cool! [NOTE: This is a Whidbey >> Visual Studio 2005 only add-in]

            • Posted by m.david : November 30, 2004 05:22 AM GMT

            Trackback Pings

            TrackBack URL for this entry:
            http://www.xsltblog.com/xslt-blog-mt/mt-tb.cgi/64

            Listed below are links to weblogs that reference XAML, VS XAML Viewer, and XSL...:

            » phentermine from phentermine
            [Read More]

            Tracked on March 5, 2006 08:45 AM

            » Free Music from Free Music
            Music, Free Music is a niceblog. [Read More]

            Tracked on March 12, 2006 05:29 PM

            Comments

            Post a comment




            Remember Me?

            (you may use HTML tags for style)

          • © 2005 :: <XSLT:Blog/> (xsltblog.com) is a product of M. David Peterson and FunctionalX Consulting. See Licensing Info Below.
          • Except where otherwise noted, this sites content and source code is licensed under the Attribution License from Creative Commons.