如何“导航"到特定的中心位置 Windows Phone 8.1 [英] How to "navigate" to Specifically hub position Windows Phone 8.1

查看:26
本文介绍了如何“导航"到特定的中心位置 Windows Phone 8.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有 5 个位置的集线器,我只想放一个按钮,当我点击时,转到特定位置...在 Pivot 控件中,我可以使用带有索引位置的 SelectedItems 但在这里...我不知道

I have a hub with 5 positions, and i just want to put a button and when i click,go to Specifically position... In Pivot control i can use SelectedItems with Index Position but here... I don't know

<Grid x:Name="MainFragment" >
            <Hub  x:Name="hubMain" Header="Você no mundo, o mundo em você!" Margin="1,0,0,0">
                <HubSection x:Name="HubOne" Header="A Faculdade dos Guararapes">
                    <DataTemplate>
                        <Grid>
                            <Border CornerRadius="50" Background="White" Opacity="0.5" >
                            </Border>
                            <Image Source="/Assets/Fg.png" Width="100" HorizontalAlignment="Center" VerticalAlignment="Top"></Image>
                            <TextBlock Text="A Faculdade dos Guararapes tem por finalidade desenvolver processos de formação de nível superior, envolvendo o ensino, a pesquisa e a extensão, a prestação de serviços à comunidade, a investigação e a difusão da cultura, da ciência, da tecnologia e das artes." TextWrapping="Wrap" Foreground="White" FontSize="20" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,125,0,0"  />
                            <Border HorizontalAlignment="Center" VerticalAlignment="Bottom" CornerRadius="50" Width="364" Height="150" Margin="11,0" >
                                <Border.Background>
                                    <ImageBrush  Stretch="Fill" ImageSource="Assets/apresentacao.png"/>
                                </Border.Background>
                            </Border>
                        </Grid>
                    </DataTemplate>
                </HubSection>

推荐答案

.ScrollToSection(HubSectionName) 是关键,我的朋友.如果您同时为集线器和集线器部分命名,则单击以下按钮应该对您有用.

.ScrollToSection(HubSectionName) is the key, my friend. If you name for both hub and hub sections then on click of the button following should work for you.

private void MyBtnClick(object sender, RoutedEventArgs e)
{
    hubMain.ScrollToSection(HubOne);
}

但是,我不建议您那样导航,因为这会违背 Hub 模板的目的.

However, I wouldn't suggest you to navigate like that, as it would defeat the purpose of Hub template.

这篇关于如何“导航"到特定的中心位置 Windows Phone 8.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆