Welcome to WindowsClient.net | Sign in | Join

Rob Relyea - XAMLified

WPF, Silverlight and XAML

April 2009 - Posts

Didn’t realize that XAML has reached verb status. Cool! From FacingBlend.com’s “Alternative uses for XAML

We’ll have to work on the dictionary definition…

Posted by Rob_Relyea | 3 comment(s)
Filed under:

As a kid, it was pretty cool to notice my name in the credits of several movies.  Ok, it wasn’t really me – Robert A. Relyea…it was Robert E. Relyea. Anyway, I just ran into an article about Robert E. Relyea (part 1 & part 2), and it turns out he has written an autobiography called “Not So Quiet on the Set”.

I don’t know if/how we are related…maybe the book will give me a clue…

More Surfing

Did some surfing on the web for other Relyea’s later this same morning…

Photos tagged with Relyea lead to a C.J.Relyea signature that looked like it had something to do with the civil war…turns out Captain C. J. Relyea was the captain of a Confederate navy ship that Robert Smalls and the rest of the slave-crew cleverly escaped with and turned over to the Union navy. Very cool story! I’m not aware of any of my ancestors who fought in the civil war…but I have searched before.

Every couple years I get excited to learn more about my family history and do some Genealogy work.

Posted by Rob_Relyea | with no comments
Filed under:

Some URI Properties

Often, in WPF/Silverlight there are objects with a Source property – Frame, Image, ResourceDictionary, and NavigationWindow are some of them – which enable you to refer to an image or another XAML file to load.

IUriContext

XAML/WPF introduced IUriContext, which is used in 2 ways by XAML:

  1. Any object that implements IUriContext will have IUriContext.BaseUri set during XAML/BAML load.
  2. Any type converter or markupextension can access IUriContext as one of the 3 service providers available in .NET 3.x to type converters or markup extensions.

For properties of type Uri, the Uri type converter helps convert the specified uri string into a Uri object.  The UriConverter is not aware of IUriContext, so your component may need to combine the IUriContext.BaseUri with the relative Uri specified as the Source property.

xml:base

In .NET 3, XAML doesn’t support xml:base to set a different base Uri.  Current builds of .NET 4 do…

xml:base=”http://someplace.com”

Tooling Difficulty

Since some properties (Image.Source) have XAML text syntaxes which allow a URI, but aren’t of type System.Uri, there is currently no way for XAML based tools to understand the complete set of properties that can take a URI text syntax.  We hope to address this in the future.  For now, tools need to hard code the fact that there are several type converters that really just want to take a URI text syntax.

Type Converters that support URI text syntax:

  • ImageSourceConverter

(I’ll grow this list over time)

Why this came up

Mike Shim (a PM on the XAML team) and I were discussing options for a bug in .NET 4 that came our way yesterday…NavigationWindow was relying on an attached property for the BaseUri…instead of IUriContext.  For now, we plan to fix NavigationWindow to use IUriContext…and determine the complete solution for v3 compat with the attached property next milestone.

Summary

Given this info, you should be able to build a XAML Vocabulary which uses relative Uris…or just understand how WPF does it.

 

Related Content

Ashish Shetty describing Resources in WPF Applications and Silverlight 2: Demystifying URI references for app resources

MSDN: Pack URIs in WPF

Shawn Wildermuth’s Silverlight XAML Relative URI’s and “Site of Origin”

Posted by Rob_Relyea | 2 comment(s)
Filed under: ,
Page view counter