Drew's Blog

The Joys of Technology Explored

Keep An Eye On This Avalon Guy

Nathan Dunlap is a designer on the Avalon team. If you're into Avalon and not already subscribed to the main LonghornBlogs feed you should, at the very least, do yourself a favor and subscribe to his feed. He recently posted an entry about the DrawingBrush class which is an awesome little utility class that lets you essentially paint anything that uses a Brush with a drawing composed of any set of Avalon visuals.

Last night he posted an new entry about re-using content. In his sample, he defines a reusable composite of vector graphics visuals in a separate XAML file and gives it the name “MyCustomCanvas”. If you're not familiar with how definition works in XAML yet, this essentially creates a new class that derives from Canvas and generates the code to add the content of his specific definition to itself (in his example, this happens to be three Rectangles). He then includes the definition of that class into his main XAML application file to create an instance of that newly defined class at a specific point in his application's visual tree. Finally, he warns us that the PDC build doesn't support multiple Include statements, but that more recent builds do. For now the work around is to define content using styles. Unfortunately that has the side effect of narrowing the ability to re-use the element to the scope in which the style is defined. So, at best, this only gets us re-use within a single XAML file.

Posted: Dec 17 2003, 11:42 AM by drub0y | with 2 comment(s)
Filed under:

Comments

Nathan Dunlap said:

Hey cool somebody is reading my blog!

Regarding the comment "So, at best, this only gets us re-use within a single XAML file."

Actually, you can use styles at higher levels than just a page level. You can create application level resources and define your styles there. I will post info on this on my blog today.
# December 18, 2003 6:21 PM

Drew Marsh said:

Heheh, it's always nice to find out you have an audience right? ;)

Oh cool, I didn't realize you could create application level XAML resources. I guess it makes sense, I just hadn't seen an example of it yet. Looking forward to your next post.
# December 18, 2003 6:24 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)