ツリービューの問題を解決しようとしています。ツリービューノードのwrappanel内でアイテム(UserControls)を注文したいと思います。
-Group
|---------------------------------------------|
|Item Item Item Item Item Item Item Item Item |
|---------------------------------------------|
+Group
+Group
ウィンドウ幅(およびツリービュー幅に沿った)が抑制され、アイテムが1行に収まらない場合は、次の行に並べ替える必要があります。
-Group
|-------------------------|
|Item Item Item Item Item |
|Item Item Item Item |
|-------------------------|
+Group
+Group
次の行にアイテムを配置しない上記の例を実行しました。これはTreeviewなしで機能していますが、treeview-node内で何かが欠落しています。
<DataTemplate x:Key="GroupTemplateFrontPage">
<Border BorderBrush="AliceBlue" BorderThickness="1" CornerRadius="10"
Background="{StaticResource TreeViewItemBackground}" >
<Expander HeaderTemplate="{DynamicResource HeaderTemplate}"
Header="{Binding}" IsTabStop="False" HorizontalAlignment="Left"
IsEnabled="True" ExpandDirection="Down" IsExpanded="True">
<Grid Margin="5,5,5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ListBox Margin="10,39,0,0" VerticalAlignment="Top" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding Modems}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel
HorizontalAlignment="Stretch"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Controls:UserControlItem Margin="4" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Expander>
</Border>
</DataTemplate>
<StackPanel Orientation="Vertical">
<TextBlock Text="Treeview" />
<TreeView Name="_treeView" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
Margin="0,0,0,0"
ItemsSource="{Binding}"
ItemTemplate="{StaticResource GroupTemplateFrontPage}" />
</StackPanel>