试图解析机场的 Maplines。每个机场可以有 X 种不同的配置。在后面的代码中,我将每个配置解析为一个单独的自定义对象集合,这些对象是绑定到TabItem
下面的数据。目前这TabItem
是 XAML 正文中的“硬编码”。如何创建一个可以从 Code behind 中声明的模板,以便创建 X 副本TabItem
?
谢谢!
<TabItem x:Name="TabTerminalMaplineDefined" Header="Airways Defined">
<Grid x:Name="GridTerminalMaplineDefined" Width="Auto" Height="Auto">
<!--AirwaysFixes Mapping Configuration ListView Start - Lists all the fixes that make up the airway-->
<ListView x:Name="ListViewTerminalMaplineDefined" Grid.RowSpan="2" Width="Auto" FontSize="9">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
<ListView.View>
<GridView>
<GridViewColumn Width="60" DisplayMemberBinding="{Binding Path=Name}" >
<GridViewColumnHeader Click="SortClickAirwaysDefined" Tag="Name" Content="Name" />
</GridViewColumn>
<GridViewColumn Width="Auto" DisplayMemberBinding="{Binding Path=X_Y_Beginning}" >
<GridViewColumnHeader Content="Segment Start" />
</GridViewColumn>
<GridViewColumn Width="Auto" DisplayMemberBinding="{Binding Path=X_Y_Ending}" >
<GridViewColumnHeader Content="Segment End" />
</GridViewColumn>
<GridViewColumn Width="Auto" DisplayMemberBinding="{Binding Path=Category}" >
<GridViewColumnHeader Click="SortClickAirwaysDefined" Tag="Category" Content="Category" />
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</Grid>
</TabItem>