[英]Xamarin Community Toolkit TabView - Navigate within Tabs
For the bottom navigation bar, I'm using a Tabbed Page, and inside of a Tabbed page, I'm using a Tabview from the Xamarin Community Toolkit.对于底部导航栏,我使用的是选项卡式页面,在选项卡式页面内部,我使用的是 Xamarin 社区工具包中的选项卡视图。 On each XCT tab, I'm loading a list of items using the collection view (Xamarin Community Toolkit TabView).
在每个 XCT 选项卡上,我正在使用集合视图 (Xamarin Community Toolkit TabView) 加载项目列表。 I need to click an item in collection view and move to another page (detail page) within the same tab of the tabbed page.
我需要在集合视图中单击一个项目并移动到选项卡式页面的同一选项卡内的另一个页面(详细信息页面)。 Although I am aware that Shell might be used, I prefer to use the method described above.
虽然我知道可能会使用 Shell,但我更喜欢使用上述方法。
You can use the SelectionChangedCommand
to bind with the ItemSelectedCommand
command and then use Navigation.PushAsync(new DetailPage());
您可以使用
SelectionChangedCommand
与ItemSelectedCommand
命令绑定,然后使用Navigation.PushAsync(new DetailPage());
to navigate to the detail page as Jason suggested.按照 Jason 的建议导航到详细信息页面。
Here's the code snippet below for your reference:下面是代码片段供您参考:
INavigation Navigation => Application.Current.MainPage.Navigation;
public ICommand ItemSelectedCommand
{
get
{
return new Command(async () =>
{
if (SelectedItem == null) return;
if(SelectedItem.Id ==1)
{
await Navigation.PushAsync(new DetailPage());
}
//else if
SelectedItem = null;
});
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.