Rob Relyea


November 2004 - Posts

  • Our 7 Goals for XAML

    Filed under:

    I like the description that Karsten, Tim, and Arik wrote about XAML from the What's New in the "Avalon" Community Technology Preview article:


    XAML. "Avalon" also introduces XAML, a markup language to declaratively represent user interface for Windows applications, improving the richness of the tools with which developers and designers can compose and repurpose UI. For Web developers, XAML provides a familiar UI description paradigm. XAML also enables the separation of UI design from the underlying code, enabling developers and designers to work more closely together.



    On top of that, I thought it would be interesting to share the 7 major goals we had in mind while designing XAML.  Generally, many design decisions require balancing the different goals (as they often conflict).


    Be XML

    All valid XAML files must be valid XML files.  The opposite isn't always true…all XML files are not XAML files.  This is important because of the ecosystem of tools, systems, APIs and developers familiar with XML.

    Describe Hierarchy of Objects in a Human Readable/Writable Way

    Markup provides a concise way to represent a set of objects arranged in a hierarchy.  It is more readable and writable than programming languages.  It is the best format to represent the initial state of an object hierarchy.


    Provide Page-Based Programming Model

    Like DHTML + ASP.NET, XAML provides a way for you to associate programming code with the declarative markup.  We recommend people having a code behind file (.xaml.vb or .xaml.cs for example.), but also support code being directly embedded inside of a XAML file.  XAML and any .Net language can work together in this page-based programming model.  The .Net Language needs to support CodeDOM and a set of language specific MSBuild target files.  In this CTP, we support C# or Visual Basic.  We will likely add J# support by spring and we look forward to supporting other languages from Microsoft (C++ and JScript) and other companies in the future.


    Be Source Code or Runtime Instructions

    Sometimes XAML is treated as source code, that gets compiled into an assembly (.exe or .dll) as a combination of a binary representation and IL.  Other times, it is interesting to build XAML at a later time and interpret it at runtime.  While we love the benefits that a markup representation give developers, we prefer to deal with XAML at compile time, not run time.


    Take Advantage of Strong-Typing

    Objects that have a strongly-typed OM (object model) are better systems to program with.  DHTML is a system that was very string-based, and thus difficult to debug.  Systems that leverage XAML (including Avalon), get the benefit of using strings in markup, but can get compile time errors for markup or code.  XAML's default is that it must understand every tag and attribute.  HTML defaults to ignoring any mistyped element name, attribute name or attribute value.  While there is a place for this ignoring to allow for forward compatibility, we'll provide a different mechanism for this.


    Be Toolable

    Systems described in XAML will be creatable and consumable by a wide set of tools.  We hope to have a clear & minimal set of rules on how classes get represented in markup.  We hope to encourage an ecosystem of tools.


    Be Useful for Much More than UI Definitions

    While XAML will be heavily used in the vast majority of Avalon applications or documents, its uses will be many.  I'm writing a command line tool right now that uses a vocabulary of classes in a XAML file used as data to drive the application.  I'm getting the following benefits over just using XML to represent this data: 1) validation of my data file without having to write a schema and using a validating xml reader; 2) my code that needs to interact with this data, does it in a strongly typed way; Intellisense works in my code behind; 3) my system has built in extensibility, instead of being tied to specific tag names, I'm tied to a specific class (and subclassing allows others to provide other specializations of that class.) 4) etc… (When this tool is done, I plan on sharing it)




    Don't Forget Why We Built XAML - Avalon!

    That all being said, I believe it is important to remember that for as interesting as XAML itself may be to some, we are building a comprehensive platform with Avalon.  Some people blog excitedly about XAML…however, many of them are actually discussing the power of Avalon, not XAML.  XAML is a way to use declarative markup with a set of CLR classes.  We're investing much more R&D in the Avalon API and Avalon infrastructure than we are in the parser and markup compiler.



    Some Related Previous XAML Posts

    Why is XAML well-formed XML? (Rob Relyea)

    XAML vs. Serialization (Chris Anderson)

    MarkupCompilation: XAML, BAML, .g.cs Details (Rob Relyea)

    When are IDs necessary in XAML & what about ID=“Root“? (Rob Relyea)

    Is it bollixed up? (Chris Anderson)

    New XAML Terminology (Rob Relyea)


  • CTP - XAML Viewer working inside VisualStudio!

    Filed under: , ,

    Gaston Milano is a self-proclaimed “VS man” -  so he wanted a XAML Viewer that worked inside of Visual Studio Whidbey.  So he wrote one!

    Screen shots look great!

    (I just left a comment with my problems getting it running on Visual C# Express.  I'll have to wait until I get into work to see it on the full Visual Studio.)
    Update: According to Gaston, VS Express SKUs don't allow the same “VSIP“ extensibility hooks.  I'll try it with the full Visual Studio later today.

    Anybody try this yet?

    Thanks Gaston!

  • Using Visual C# Express or Visual Basic Express with the Avalon CTP

    Filed under: ,

    I saw Joe Duffy's post about the Avalon CTP where he said:

    “And it's compatible with the Express SKUs as well.“

    Our team only tested the Avalon CTP with the Express SKUs briefly.  We found one major problem (and weren't able to fix it for this release):

    the Express SKUs look for project templates and item templates in a different path than normal Visual Studio builds.


    If you want to use an Express SKU, after installing one of the Visual Studio Express skus, Avalon, and then the WinFX SDK, you'll need to do the following:

    Workaround: Installation of Templates by WinFX SDK for Visual C# Express:

    • Default Visual C# Express install location is: C:\Program Files\Microsoft Visual Studio 8\, if you installed elsewhere, run the following command (but change the location as appropriate) in a command window:
    set MyVisualStudioLocation="%programfiles%\Microsoft Visual Studio 8"

    Then, copy and paste these commands (all at once) into the same command window:

    copy "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates\CSharp\Avalon\1033\*.zip" %MyVisualStudioLocation%\Common7\IDE\VCSExpress\ProjectTemplates\1033
    copy "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates\CSharp\1033\*.zip" %MyVisualStudioLocation%\Common7\IDE\VCSExpress\ItemTemplates\1033
    copy "%programfiles%\microsoft visual studio 8\xml\schemas\avalonFall2004CTP.xsd" %MyVisualStudioLocation%\xml\schemas\
    copy "%programfiles%\microsoft visual studio 8\xml\schemas\xamlFall2004CTP.xsd" %MyVisualStudioLocation%\xml\schemas\
    %MyVisualStudioLocation%\Common7\IDE\VCSExpress.exe /setup

    Workaround: Installation of Templates by WinFX SDK for Visual Basic Express:

    • Default Visual Basic Express install location is: C:\Program Files\Microsoft Visual Studio 8\, if you installed elsewhere, run the following command (but change the location as appropriate) in a command window:
    set MyVisualStudioLocation="%programfiles%\Microsoft Visual Studio 8"

    Then, copy and paste these commands (all at once) into the same command window:

    copy "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates\VisualBasic\Avalon\1033\*.zip" %MyVisualStudioLocation%\Common7\IDE\VBExpress\ProjectTemplates\1033
    copy "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates\VisualBasic\1033\*.zip" %MyVisualStudioLocation%\Common7\IDE\VBExpress\ItemTemplates\1033
    copy "%programfiles%\microsoft visual studio 8\xml\schemas\avalonFall2004CTP.xsd" %MyVisualStudioLocation%\xml\schemas\
    copy "%programfiles%\microsoft visual studio 8\xml\schemas\xamlFall2004CTP.xsd" %MyVisualStudioLocation%\xml\schemas\
    %MyVisualStudioLocation%\Common7\IDE\VBExpress.exe /setup
    We hope to make this automatic for the next CTP (or convince the Visual Studio team to use a different filtering mechanism for templates.”
    One other problem we found (only cosmetic) - the icons for the templates look like they are the wrong resolution.
    Don't know why this happens fine in the non-express Visual Studio skus.
    Updated: I had copy and pasted from a web this post was very wide.  I hand changed several <Pre> elements to <Div> elements to fix...
    Update2: Chris found that I had some extra quotes around the destination directory of the copy commands that his command window didn't like.  Removed them...
    Update3: some regkeys that get set to change VisualStudio behavior weren't having effect for Visual C# Express and Visual Basic Express.
    All settings of DefaultBuildActions from HKLM\Software\Microsoft\VisualStudio\8.0\Projects\{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\FileExtensions\ need to be created under HKLM\Software\Microsoft\VCExpress\...
    All settings of DefaultBuildActions from HKLM\Software\Microsoft\VisualStudio\8.0\Projects\{F184B08F-C81C-45F6-A57F-5ABD9991F28F}\FileExtensions\ need to be created under HKLM\Software\Microsoft\VBExpress\...
    We will likely post a batch file to make this easier to repair.
  • 3rd public release of Avalon...a few details on the development experience

    Filed under: , ,

    First, PDC 2003.  Second, WinHec 2004. Now an Avalon Customer Tech Preview!

    Three interesting links way below that I stole from

    First, a link to the bits for MSDN members.
    Second, a link to online documentation and samples.
    Third, a good overview of what is new or changed in this release.

    I'm happy that this release will able to run on Windows XP (and Windows Server 2003 too).  I have this build running on my laptop with xp sp2, and it has very little impact on my daily use unless I'm building an application and running it.

    Installing VS beta1, Avalon, and then WinFX SDK will give you a decent VS development experience for Avalon applications.

    We have 4 project templates for Visual Basic or C# developers.
    Avalon Application
    Avalon Browser Application - will run in Internet Explorer by just changing a property in the .csproj or .vbproj file
    Avalon Navigation Application
    Avalon Control Library

    In the xml editor, while editing a XAML page, you should get decent intellisense since the WinFX SDK installs a schema for Avalon class use in XAML.  Look in %programfiles%\microsoft visual studio 8\xml\schemas\ for avalon*.xsd and xaml*.xsd

    No visual designer yet...  :-(

    F1 Help works from C# or VisualBasic code.  In the XML Editor though, it is broken in this build.

    No major XAML syntax changes in this build, but many changes to the elements and other features you can use.

    Give it a try...would love to see what you can do with it...

    Shipping feels good!


    "Avalon" Community Technology Preview Available
    The Community Technology Preview of "Avalon" can be found in the Microsoft® WinFX™ Software Development Kit (SDK), available for download by MSDN Subscribers. It contains documentation, samples, command-line compilers, and tools designed to help you develop managed-code applications and libraries using WinFX.   

    WinFX SDK Online WinFX SDK Online
    The WinFX SDK for the version of WinFX that includes the Avalon class libraries and runs under Windows XP is available for your perusal online.   

    What's New in the What's New in the "Avalon" Community Technology Preview
    In this article, we'll take a brief look at some of the changes that have been made to Avalon since the PDC release a year ago, and highlight some useful resources to help you further explore Avalon.