向PivotItem添加多个Item / Control

时间:2014-09-11 05:37:09

标签: c# xaml windows-phone-8 pivotitem

如何向PivotItem添加多个Item / Control?


  <!--Pivot Control-->
    <phone:Pivot x:Name="PivotLanguageMain" Margin="0,116,0,0" Foreground="White" Background="{x:Null}">
        <!--Pivot item one-->
        <phone:PivotItem x:Name="PivotItemGurbani" Margin="0,-6,0,0"  >
            <phone:PivotItem.Header>
                <TextBlock Text=" gurmuKI"  FontFamily="/Assets/Fonts/GURAKHAR.TTF#GurbaniAkhar" />
            </phone:PivotItem.Header>
            <ListBox  Margin="0,25,0,72"  x:Name="ListBoxPunjabi" FontSize="48" HorizontalAlignment="Center" SelectionChanged="ListBoxPunjabi_SelectionChanged">

            </ListBox>
        </phone:PivotItem>


        <!--Pivot item two-->
        <phone:PivotItem  x:Name="PivotItemEnglish"  Margin="0,-6,0,0"  >

            <phone:PivotItem.Header>
                <TextBlock Text=" english" FontFamily="/Assets/Fonts/AGENCYR.TTF#Agency FB" />
            </phone:PivotItem.Header>


            <ListBox Margin="0,25,0,48"  x:Name="ListBoxEnglish" HorizontalAlignment="Center" SelectionChanged="ListBoxEnglish_SelectionChanged">

            </ListBox>
            <Popup x:Name="LoadingPopup">
                <TextBlock x:Name="LoadingText" Text="Loading PDF File.." Foreground="#FFBB0000" FontFamily="/Assets/Fonts/AGENCYR.TTF#Agency FB" FontSize="50" FontWeight="Bold" Margin="102,164,93,360"/>
            </Popup>
        </phone:PivotItem>

    </phone:Pivot>

第二个PivotItem给了我错误: 属性&#39;内容&#39;只能设置一次

1 个答案:

答案 0 :(得分:1)

在Grid上添加您的控件。

    <phone:PivotItem x:Name="PivotItemGurbani" Margin="0,-6,0,0"  >
        <phone:PivotItem.Header>
            <TextBlock Text=" gurmuKI"  FontFamily="/Assets/Fonts/GURAKHAR.TTF#GurbaniAkhar" />
        </phone:PivotItem.Header>
        <ListBox  Margin="0,25,0,72"  x:Name="ListBoxPunjabi" FontSize="48" HorizontalAlignment="Center" SelectionChanged="ListBoxPunjabi_SelectionChanged">

        </ListBox>
    </phone:PivotItem>



    <phone:PivotItem  x:Name="PivotItemEnglish"  Margin="0,-6,0,0"  >

        <phone:PivotItem.Header>
            <TextBlock Text=" english" FontFamily="/Assets/Fonts/AGENCYR.TTF#Agency FB" />
        </phone:PivotItem.Header>
        <Grid>
        <ListBox Margin="0,25,0,48"  x:Name="ListBoxEnglish" HorizontalAlignment="Center" SelectionChanged="ListBoxEnglish_SelectionChanged">
        </ListBox>
        <Popup x:Name="LoadingPopup">
            <TextBlock x:Name="LoadingText" Text="Loading PDF File.." Foreground="#FFBB0000" FontFamily="/Assets/Fonts/AGENCYR.TTF#Agency FB" FontSize="50" FontWeight="Bold" Margin="102,164,93,360"/>
        </Popup>
        </Grid>
    </phone:PivotItem>

</phone:Pivot>