June 19, 2004 .net

Chris Anderson on Avalon Visual Extensibility

Chris Anderson just did a fabulous job describing what makes Avalon more extensible than existing popular UI frameworks. What Avalon allows is the ability to have a Button instance like so:

<Window>
  <Button>Hello</Button>
<Window>

And then, somewhere else, using Styles, setting the VisualTree of what a Button looks like to be whatever you like, e.g.

<Style>
  <Button />
  <Style.VisualTree>
    <FlowPanel>
      <!-- anything you like in here, e.g. <Text>, <Video>, <Rectangle>, whatever -->
      <ContentPresenter />
    </FlowPanel>
  </Style.VisualTree>
</Style>

Two interesting things about this button style. The first is that you can make a Button look however you want it to look, without worrying whether the Avalon team had that in mind up front. Two, when you want to drop in the content inside the Button tag, e.g. Hello”, you drop in the ContentPresentor and it knows how to display what was placed in the Button (again, which could be anything). Simple and flexible: two things that I’m finding to be true more and more about Avalon the further I dig.