我在页面上有两个透视项目,我想根据前一页面按钮显示特定的透视项目。我有两个按钮,名为" contact"和#34;帮助"。我希望当用户点击联系按钮项目1首先显示,当用户点击帮助项目时首先显示。如何做?
这是我的xaml
<Pivot x:Name="MyPivot">
<PivotItem x:Name="contact" >
<PivotItem.Header>
<TextBlock FontFamily="Assets/fonts/KBPlanetEarth.ttf#KBPlanetEarth" Foreground="Purple" Margin="0,20,0,0">Contact</TextBlock>
</PivotItem.Header>
<StackPanel>
<Image VerticalAlignment="Top" Width="250" Height="150" HorizontalAlignment="Left" Source="Assets/icons/logo.png"></Image>
<TextBlock Foreground="Black" FontFamily="Comic Sans MS" TextWrapping="Wrap" FontSize="20">Feel Free to contact for any errors,updates and for don't forget to review.</TextBlock>
<Button Click="Button_Click" Height="80" Width="180" Margin="0,10,0,0" FontFamily="Assets/fonts/Arista2.0.ttf#Arista 2.0" Background="#27aae0" FontSize="25" Content="Email" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" ></Button>
<Button Click="Button_Click_1" Height="80" Width="180" Margin="0,10,0,0" FontFamily="Assets/fonts/Arista2.0.ttf#Arista 2.0" Background="#27aae0" FontSize="25" Content="Facebook" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" ></Button>
<Button Click="Button_Click_2" Height="80" Width="180" Margin="0,10,0,0" FontFamily="Assets/fonts/Arista2.0.ttf#Arista 2.0" Background="#27aae0" FontSize="25" Content="Review" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" ></Button>
</StackPanel>
</PivotItem>
<PivotItem x:Name="helped" >
<PivotItem.Header>
<TextBlock FontFamily="Assets/fonts/KBPlanetEarth.ttf#KBPlanetEarth" Foreground="Purple" Margin="0,20,0,0">Help</TextBlock>
</PivotItem.Header>
<FlipView>
<FlipViewItem>
<Image Source="Assets/7.png"></Image>
</FlipViewItem>
<FlipViewItem>
<Image Source="Assets/15.png"></Image>
</FlipViewItem>
</FlipView>
</PivotItem>
</Pivot>
答案 0 :(得分:1)
您可以通过更改MyPivot.SelectedIndex
的值来更改显示的项目