0

试图解析机场的 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>
4

1 回答 1

0

使用数据模板

于 2009-09-02T12:31:45.603 回答