Добрый день! Есть TreeView, в нем есть кнопки, хочется сделать чтобы все эти кнопки был в одной колонки, друг под другом, в правой части TreeView, как это можно сделать?
Примерно так:
Текущий код:
<ScrollViewer Grid.ColumnSpan="3" Grid.Row="1" x:Name="scroll">
<TreeView x:Name="tree" Margin="0,0,0,0" MaxWidth="{Binding ActualWidth, ElementName=scroll}">
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="True" />
</Style>
</TreeView.ItemContainerStyle>
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type app_for_portfolio:Folder}" ItemsSource="{Binding Items}">
<Grid MaxWidth="{Binding ActualWidth, ElementName=tree}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Text}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Column="0"/>
<TextBlock Text="{Binding LastResult}" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="1"/>
<TextBlock Text="{Binding LastTimer}" Margin="5,0,0,0" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="2"/>
<Button Content="Start Timer" Margin="5,0,0,0" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="3"/>
<Button Content="Scan" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="4"/>
<Button Content="Report" Margin="0,0,0,0" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="5"/>
</Grid>
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type app_for_portfolio:Item}">
<TextBlock Text="{Binding Text}"/>
</DataTemplate>
</TreeView.Resources>
<app_for_portfolio:Folder x:Name="maintree" Text="Main"/>
</TreeView>
</ScrollViewer>