views:

118

answers:

1

I'm kinda new at XAML and I'm trying to figure how to display the TreeView nodes horizontally instead of vertically, i.e

Header 1
  Item 1 Item 2 item 3
Header 2
  Item 4

Instead of

Header 1
  Item 1
  Item 2
  Item 3
Header 2
  Item 4   

It's not really as simple as it seems, I was able to get the headers to go horizontally though...

XAML Code below

<Grid >      
<TreeView ItemsSource="{Binding Children}">
    <TreeView.Resources>
        <HierarchicalDataTemplate DataType="{x:Type local:ApplicationListViewModel}"
                                  ItemsSource="{Binding Children}">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Title}"/>
            </StackPanel>
        </HierarchicalDataTemplate>
        <DataTemplate DataType="{x:Type local:ApplicationViewModel}" >                    
            <StackPanel Orientation="Horizontal">
                <ListView>                        
                    <Button>
                        <Image Source="{Binding Image}"/>
                    </Button>
                </ListView>
            </StackPanel>
        </DataTemplate>
    </TreeView.Resources>
</TreeView>





If it helps to know what I'm trying to accomplish with my code, then basically I'm trying to organise applications in a series of categories. A container(like a list box) is generated for each application category.

The data structure I have is

Application Collection
   Application List (1-> Many)
      Application (1-> Many)
A: 

There's a codeproject article that explains exactly how to do this... Hope it helps :)

IanR
Yup that answers the question perfectly, thank you. I passed over that article initially cause I wouldn't have thought about using styles to do that.
John