Wednesday, March 14, 2007

InlineUIContainer and BlockUIContainer

I've been doing a project using Avalon (WPF, if you insist on using the sucky name), and have been learning a lot. I think it's the coolest of the .NET 3.0 family of technologies. Although I'm going to be attending Pluralsight's upcoming Workflow & WCF Double Feature in Waltham, so maybe more exposure will change my mind. I doubt it, though. :)


One of the areas that really interests me in Avalon is System.Windows.Documents. It interests me because it looks like it could make the next version of FlexWikiPad really easy to write - a well-thought-out model for text presentation that doesn't require messing around with a WebBrowser control. I'd even gone so far as to start writing a text editor control using .NET 1.1-era technologies. So I was happy when my current project gave me a chance to start dabbling in FlowDocument and friends.


One of the questions I ran across pretty quickly was "How do I include an image in a FlowDocument?" There's no Image element in System.Windows.Documents - just stuff like Paragraph, List, Bold, Span, etc. A quick question fired of to Ian (tired of my questions yet, dude?) revealed InlineUIContainer and BlockUIContainer, two wonderful classes that let you embed arbitrary Avalon controls inside a FlowDocument. All I had to do was wrap one of them around a System.Windows.Controls.Image control and I was off to the races.


Definitely a nice pair of bullets for the Avalon gun.

No comments:

Post a Comment