我在我的项目中创建tabbedpage导航,我在第1页有按钮,当您单击该按钮时,它必须转到第2页,它将在表页的第2页上滑动。
我就是这样设计我的TabbedPage XAML的
<TabbedPage
android:TabbedPage.IsSmoothScrollEnabled="True" >
<local:Home Title="Home"/>
<local:MapsLocation Title="Map"/>
<local:FeedbackPage Title="Feedback"/>
<local:Profile Title="Profile"/>
</TabbedPage>这是我在按钮命令中的代码
public ICommand GotoCommand { get; }
private async void GotoExecute(object sender)
{
var MyObject = (Shop)sender;
await Navigation.PushAsync(new MapsLocation(MyObject.Address));
}当您单击按钮时,它应该滑到第2页。
第2页,当您单击第1页中的按钮时,它应该放在这里。
它应该滑到TabbedPage的第二个孩子
我怎样才能做到这一点?
发布于 2022-10-26 01:42:56
如果您想滑到其他Tabbedpage,您可以使用下面的代码来实现它。注意,tab.Childrenindex的索引从0开始,它应该<子表页的计数,否则会抛出错误Index was out of range。
private void Button_Clicked(object sender, EventArgs e)
{
var tab = this.Parent as TabbedPage;
tab.CurrentPage = tab.Children[1];
}https://stackoverflow.com/questions/74195331
复制相似问题