I have a Index.xaml page which has the following PagePresentation:
[MvxMasterDetailPagePresentation(Position = MasterDetailPosition.Detail,
WrapInNavigationPage = true, Title = "Demo")]
It will show the hamburger icon in the navigation bar and all works fine.
The menu that is displayed when you click the hamburger menu has:
[MvxMasterDetailPagePresentation(MasterDetailPosition.Master)]
Now when I navigate from the detail page to a Detail.xaml I would expect that the Detail.xaml would show the back arrow in the navigation bar, but here it also shows the hamburger icon. Detail.xaml doesn't have a PagePresentation attribute.
I navigate to Index.xaml using the code:
_navigationService.Navigate(typeof(DetailViewModel), parameter);
When I remove the MvxMasterDetailPagePresentation from Index.xaml the hamburger menu is gone and Detail.xaml does show the back arrow but I need the hamburger icon in Index.xaml.
I played around with PagePresentations but I couldn't get it to work.
How can I achieve the desired behavior?
As it says in the docs:
Position | TabbedPosition | Use this to set the position of the Page. It can either be the Root to host Pages, or as a Tab to be a Page inside the TabbedPage
You don't have any Root there to host the pages, so your Index.xaml should be set to:
[MvxMasterDetailPagePresentation(MasterDetailPosition.Root, WrapInNavigationPage = false)]
Your menu:
[MvxMasterDetailPagePresentation(MasterDetailPosition.Master)]
Your detail:
[MvxMasterDetailPagePresentation(MasterDetailPosition.Detail, WrapInNavigationPage = true, NoHistory = true)]
The Stars wars sample is a good place to see it working.
HIH
Related
I have a toolbar with 3 menu items and I want to achieve that if I click on one of them the text would change it's color. The closest I get to achieve this is I used focus in css but it's not the best because if I click somewhere else it's gone. Is there any possible way to achieve this?
The admin should be in green color as well till I click on another menu item e.g. time management.
If you follow a pattern for url then it's possible
For Example
Admin has link /admin
Users has link /admin/users
Logs has link /admin/logs
Then in your navbar use ng-class="getClass('/admin')". Then you can use function something like below
$scope.getClass = function (path) {
return ($location.path().substr(0, path.length) === path) ? 'active' : '';
}
Refernce: SO:how-to-highlight-a-current-menu-item
When I return to the Root Page with this method:
Page page = (Page)Activator.CreateInstance(typeof(TrasfMagaPage), session);
Navigation.InsertPageBefore(page, Navigation.NavigationStack[0]);
await Navigation.PopToRootAsync(true);
The icon of the hamburger menu disappears from the TopBar.
I use the same code with all the other pages, but only in this case it presents the problem.
How is that possible?
I have written code similar to this to prevent a white flicker that appears in Android master detail pages. When inserting a page before the root, I use the Navigation of the Detail page.
Detail.Navigation.InsertPageBefore(page, root);
await Detail.Navigation.PopToRootAsync(false);
Making UI of my app using code only.
Can't find how customize couple elements:
1. Button 'Back' now it looks like:
and it should looks like:
So, how I can get rid of 'Back' text from button title, keeping '<' system icon there? And how I can change colors of back button and title of navigation bar?
try
self.navigationController?.navigationBar.tintColor = UIColor.white
Try:
override func viewDidLoad(){
//any other initial stuffs
//for the bar
navigationController?.navigationBar.tintColor = UIColor.black
//for the button
navigationController?.navigationBar.backItem?.titleView?.tintColor = UIColor.white
}
Follow the instruction from your xcode. You can do this easily. I also marked on the image . Select 1. Select the Standard Editor, 2. Show the File inspector 3 Set global Ting
With XCode 12.3 can change the Title Color and Back Button using the following.
I have a MasterDetail page which in Xaml has defined a navigation menu as a master bit and just an empty Detail.
Once user logs in I navigate to the main page using the following path
await _navigationService.NavigateAsync(PageCodes.NavigateTo_MainMenuPage + "/" + PageCodes.NavigateTo_NavigationPage + "/" + PageCodes.NavigateTo_WelcomePage);
NavigateTo_MainMenuPage is my MasterDetail Page
NavigateTo_NavigationPage an empty Navigation page
NavigateTo_WelcomePage my home page (content page)
This works perfectly, iOS shows both Navigation (master) and Welcome page (content page)
One of the options in the navigation is to go to About page (so user triggers this via MasterDetail.Master XAML)
I expected that this code
await _navigationService.NavigateAsync(PageCodes.NavigateTo_WebPage, param);
will replace the Detail bit of the MasterDetail Page but instead of that it opens it as a model page (full screen) and app loses the Hamburger menu. I even tried to add false, after param but it didn't work
This code
await _navigationService.NavigateAsync(PageCodes.NavigateTo_NavigationPage + "/" + PageCodes.NavigateTo_WebPage, param, false);
opens the page as a child of the main page (iOS shows back to welcome page) which I don't want.
I even tried this code
await _navigationService.NavigateAsync(PageCodes.NavigateTo_MainMenuPage + "/" + PageCodes.NavigateTo_NavigationPage + "/" + PageCodes.NavigateTo_WebPage, param, false);
but it shows NavigateTo_WebPage without Master page and as I can see the hamburger menu is missing
Just to clarify all this code is happening in the view of MainMenuPage (MainMenuPageViewModel)
So My question is what I'm doing wrong and how to push with Prism new content to Detail bit of MasterDetail page
thanks in advance!!!
I've managed to fix the problem. My Navigation page didn't have a ViewModel. Frankly, I thought as it's a dummy page without any logic I don't need the ViewModel.
As soon as I added the page, everything was fine
website I am talking about: http://www.formunddrang.de
When a menu item is active I am using the tag li.selected_page to set the color of the menu item to blue.
In order to link to a category instead of a wp-page I am using the plugin "Page Links To" which allows me add a link instead of a page to the menu. This menu item does not have the li.selected_page tag - it does not seem to know at all when it has been selected.
Does anyone see a way to access the status of the "Einblicke" menu item so i can make it blue when it is active?
Thanks a lot!
You might do it via jquery:
var url = window.location;
// Will only work if string in href matches with location
$('#cms-nav-top-menu a[href="'+ url +'"]').addClass('active');
// Will also work for relative and absolute hrefs
$('#cms-nav-top-menu a').filter(function() {
return this.href == url;
}).addClass('active');
Give it a try and tell me if it's working.