There is a certain collection ICollection<OperandItemVM> Operands
OperandItemVM
looks like this:
public class OperandItemVM : INotifyPropertyChanged { public string OperandName { get; set; } public string Value{ get; set; } public string Path{ get; set; } }
It is impossible to display this information in this form (single-level tree):
I am trying this way right now, but the disclosure icon is not displayed:
<TreeView HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding Operands}"> <TreeView.ItemTemplate> <HierarchicalDataTemplate DataType="{x:Type vm:OperandItemVM}"> <StackPanel Orientation="Horizontal" MinHeight="25"> <TextBox Text="{Binding OperandName}" VerticalAlignment="Center"/> <Button Width="19" Height="19" Margin="15,0,0,0"> <TextBlock Text="X" VerticalAlignment="Center"/> </Button> </StackPanel> <HierarchicalDataTemplate.ItemTemplate> <DataTemplate DataType="{x:Type vm:OperandItemVM}"> <Grid Margin="3"> <Grid.RowDefinitions> <RowDefinition Height="Auto" MinHeight="23"/> <RowDefinition Height="3"/> <RowDefinition Height="Auto" MinHeight="23"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" MinWidth="91"/> <ColumnDefinition Width="3"/> <ColumnDefinition Width="3*" MinWidth="101"/> </Grid.ColumnDefinitions> <TextBlock Grid.Row="0" Grid.Column="0" Text="Значение"/> <Border Grid.Row="0" Grid.Column="2"> <TextBlock Text="{Binding Value}"/> </Border> <TextBlock Grid.Row="2" Grid.Column="0" Text="Путь"/> <Border Grid.Row="0" Grid.Column="2"> <TextBlock Text="{Binding Path}"/> </Border> </Grid> </DataTemplate> </HierarchicalDataTemplate.ItemTemplate> </HierarchicalDataTemplate> </TreeView.ItemTemplate>
Please tell me where I am wrong?