Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update example to show how to do navigation with tabbed pages #66

Closed

Conversation

ScarlettCode
Copy link
Contributor

closes #52

This example shows the following

Creating a tab page in xaml and navigating to a tab with the query string
Create tabs at runtime with the query string
Navigating to a tab via the querystring
Changing to another tab with the navigation service

Copy link
Member

@dansiegel dansiegel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In thinking more about this. This is a good start but this really needs a couple of changes.

  • We need to show IInitialize and INavigationAware across each of the ViewModels. Each one should set a different property from the Navigation Parameters
  • We need to show the use of the SelectTab extension to programmatically switch tabs

@ScarlettCode
Copy link
Contributor Author

  • Should we not be showing IActiveAware as INavigationAware only gets called for the first tab you land on which isn't super helpful compared to IActiveAware? Or be showing both?

  • TabCPageViewModel uses the SelectTabAsync to set a tab. I need to correct the asyncness of that but I think that's what you referring to?

08-TabbedNavigation/src/PrismSample/Views/TabsPage.xaml Outdated Show resolved Hide resolved
08-TabbedNavigation/src/PrismSample/Views/TabCPage.xaml Outdated Show resolved Hide resolved
Comment on lines 4 to 5
xmlns:prism="http://prismlibrary.com"
prism:ViewModelLocator.AutowireViewModel="True"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the ViewModelLocator.AutowireViewModel property as it is not needed here.

08-TabbedNavigation/src/PrismSample/Views/TabBPage.xaml Outdated Show resolved Hide resolved
08-TabbedNavigation/src/PrismSample/Views/TabAPage.xaml Outdated Show resolved Hide resolved
08-TabbedNavigation/src/PrismSample/Views/MainPage.xaml Outdated Show resolved Hide resolved
Comment on lines +27 to +29
$"?{KnownNavigationParameters.CreateTab}=TabCPage" +
$"&{KnownNavigationParameters.CreateTab}=TabBPage" +
$"&{KnownNavigationParameters.CreateTab}=TabAPage");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// KnowNavigationParameters.CreateTab == createTab
createTab=TabCPage&createTab=TabBPage

var p = new NavigationParameters();
p.Add("ActiveCount", 0);

await _navigationService.NavigateAsync("TabsPage?selectedTab=TabBPage", p);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a comment:

// await _navigationService.NavigateAsync("TabsPage?selectedTab=TabBPage", ("ActiveCount", 0));

Comment on lines +11 to +14
public TabsPageViewModel()
{

}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a Title property... and be sure to wrap this page in a NavigationPage

xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:prism="http://prismlibrary.com"
xmlns:views="clr-namespace:PrismSample.Views;assembly=PrismSample"
x:Class="PrismSample.Views.TabsPage">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to bind a the Title to the ViewModel

@Kylar182
Copy link

Kylar182 commented Sep 8, 2020

Considering t here's nothing at all in the master branch can we have this to just have something? Even if it's not perfect?

@brianlagunas
Copy link
Member

Closing as requested changes have not been made in a timely manner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Update] 08 Tabbed Navigation
4 participants