我知道有一些问题具有相同的标题,但我找不到任何对我有用的答案。
在 Xml 文件中获取三重 ListBox ,它是由 3 个内部 Observable 集合构建的。(寄存器列表包含字段列表,字段列表包含 int 列表)。
Xaml:
<ScrollViewer HorizontalScrollBarVisibility="Auto">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
<RowDefinition MaxHeight="50"/>
</Grid.RowDefinitions>
<ListBox x:Name="RegistersListView" ItemsSource="{x:Bind registersList}" Grid.Row="1">
<ListBox.ItemTemplate>
<DataTemplate x:DataType="structures:Register">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="{x:Bind name}" Grid.Row="0" />
<ListBox x:Name="FieldsListView" ItemsSource="{x:Bind reg_fields}" Grid.Row="1">
<ListBox.ItemTemplate>
<DataTemplate x:DataType="structures:Field">
<StackPanel>
<TextBlock Text="{x:Bind name}"/>
<ListBox x:Name="BitsListView" ItemsSource="{x:Bind bitsList}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</Grid>
</DataTemplate> …Run Code Online (Sandbox Code Playgroud)