XAML Treeview, how to displayed nodes horizontally instead of vertically
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 Coll开发者_StackOverflow社区ection Application List (1-> Many) Application (1-> Many)
There's a codeproject article that explains exactly how to do this... Hope it helps :)
精彩评论