当我从另一个页面Windows Phone 8.1返回时,如何导航到特定的集线器

时间:2015-05-14 19:53:45

标签: c# windows-phone-8.1

我有两个HubSections ......

第一......

<HubSection  Header="Graduação Piedade - Jaboatão">
                    <DataTemplate>
                        <Grid>
                            <ListView x:Name="List"  SelectedItem="true" SelectionChanged="Lista_Gradua_Pie">
                                <Grid>
                                    <Image Source="/Assets/adm.jpg" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    <Border Background="#A5000000" Height="80" VerticalAlignment="Bottom">
                                        <TextBlock Text="Administração" FontFamily="Segoe UI" FontSize="26.667" Foreground="#CCFFFFFF" Padding="15,20"/>
                                    </Border>
                                </Grid>

和第二......

<HubSection  Header="Graduação Recife">
                    <DataTemplate>
                        <Grid>
                            <ListView SelectedItem="true" SelectionChanged="Lista_Recife">
                                <Grid>
                                    <Image Source="/Assets/mecan.jpg" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    <Border Background="#A5000000" Height="80" VerticalAlignment="Bottom">
                                        <TextBlock Text="Engenharia Mecânica" FontFamily="Segoe UI" FontSize="26.667" Foreground="#CCFFFFFF" Padding="15,20"/>
                                    </Border>
                                </Grid>

你可以在我的&#34; SelectionChanged&#34;里面看到我有这个..

var a = sender as ListView;
        if (a.SelectedIndex == 0)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => this.Frame.Navigate(typeof(Adm)));
        }

但是,每次当我回到页面(adm)时,他都会去第一个HubSection,但我想要的是转到hubSection我想要的东西!

1 个答案:

答案 0 :(得分:0)

在OnNavigatedTo()中,您可以设置Hub.DefaultSectionIndex属性。