gpt4 book ai didi

c# - XAML Treeview,如何水平而不是垂直显示节点

转载 作者:太空宇宙 更新时间:2023-11-03 11:52:02 25 4
gpt4 key购买 nike

我是 XAML 的新手,我正在尝试弄清楚如何水平而不是垂直显示 TreeView 节点,即

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

Instead of

Header 1  Item 1  Item 2  Item 3Header 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>





如果了解我试图用我的代码完成什么会有所帮助,那么基本上我是在尝试将应用程序组织成一系列类别。为每个应用程序类别生成一个容器(如列表框)。

我的数据结构是

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

最佳答案

有一个代码项目article这确切地解释了如何做到这一点......希望它有帮助:)

关于c# - XAML Treeview,如何水平而不是垂直显示节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1856363/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com