简体   繁体   中英

How can I navigate to a specific hub when I come back from another page Windows Phone 8.1

I have two HubSections....

The First....

<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>

and Second....

<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>

and as you can see inside of my "SelectionChanged" i have this..

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

But, everytime when i comeback to page (adm) he go to first HubSection, but what i want is go to the hubSection what i wish!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM