views:

38

answers:

0

Hi,

I need to display xaml code in a panel, how do I write DataTemplates to format the xaml with proper indentation and hyperlinks for references (such as StaticResource etc), for example,

<ListBox ItemsSource="{Binding}" ItemTemplateSelector="{StaticResource ResourceKey=selector}">
  <ListBox.ItemsPanel>
    <ItemsPanelTemplate>
      <DockPanel />
    </ItemsPanelTemplate>
  </ListBox.ItemsPanel>
</ListBox>

I would like to make "selector" a hyperlink, I have an idea how to wire up the link, but struggling to get the xaml to display properly (with indentation and links).

My current version tries to parse the xaml code and tokenize it such that I can use a DataTemplateSelector to choose which DataTemplate to use, but I'm wondering if there is a simpler, more elegant way to accomplish this.

Any help will be much appreciated, thanks.