Currently I am using Showviewmodel for navigating to different pages in Navigation drawer, but I click back I am able to see all my previous pages.So is there anyway to clear all previous fragment stack using mvvmcross?
You need to add the attribute
[Activity(NoHistory = true)]
on top of each MvxActivity you dont want to save in the backstack
Related
Above mentioned solution is not working for my project in iOS , (this,"false") can you please help me to sort out the issue . Screenshot attached for your reference. How to hide back button in navigation bar xamarin forms
If you want to set the title of this page, set a SetBackButton on the page you want to return to.
You can add the following code to the page's constructor to hide the back button:
NavigationPage.SetHasBackButton(this, false);
I am trying to work with the Google Place Picker API
(https://developers.google.com/places/ios-api/placepicker)
I and want to edit a few things when the modal PlacePicker view appears.
For example the 'Title' should be either another language or set by me. Or generally edit navigation bar (left button etc).
I would also like to change the mapStyle ?
I am trying to add an image next to the hamburger menu in my app. I am using a master detail page and it renders fine in ios and android. I tried using setting the icons for the detail pages. but the icons never showed. How do I achive this. I am looking to add an image similar to the amazon app.
I checked out this app on my phone and it uses a lot of custom constructions that aren't supported by out of the box Xamarin Forms controls. Something like the back arrow next to the hamburger menu is not a standard thing (on iOS at least). Also looking at the actual menu that the hamburger button triggers it becomes clear that its not an out of the box hamburger menu. Theirs pops over the content instead of sliding it out of view as the built-in one does.
More than likely they implemented their own hamburger menu and navigation structure which gave them the freedom to add buttons next to it. If you want to achieve this with out of the box controls you will most likely need custom renderers for each platform to create a replica of this navigation structure.
What is built-in in Xamarin Forms is that you can set the page title to an image instead of text by using the NavigationPage.SetTitleIcon method, which could be used to achieve what you want:
public class MyPage : NavigationPage
{
public MyPage ()
{
var myContentPage = new MyContentPage (Color.White);
this.Push (myContentPage);
var s = "icon.png";
NavigationPage.SetTitleIcon (myContentPage, s);
}
}
Even then, this is limited in functionality. If you want to fiddle with the alignment of the image e.g. you would also need to resort to a custom renderer.
Does anyone have example code illustrating how one would use the "MXTouchViewGroup*" code in the framework to create/use a tab bar at the bottom. Looking at code for MXToughViewGroup*, it isn't 100% clear how I would setup/use the navigation framework with a tab bar. Unfortunately the MonoCross book also has no examples of this case.
Any help would be appreciated.
Thanks in Advance.
So after poking around in MonoCross source, I've figured out how one would use a MonoTouch/iOS tab bar while using the MonoCross pattern, and specifically while continuing to use MonoCross.Navigation to move around your app:
//------- MonoCross Shared Application
// Main Menu
NavigationMap.Add("Menu/Tab1", new Tab1Controller());
NavigationMap.Add("Menu/Tab2", new Tab2Controller());
NavigationMap.Ass("Other", new OtherController());
// Set default navigation URI
NavigateOnLoad = "Menu/Tab1";
//------- MonoCross.Touch Container
// init monocross application
MXTouchContainer.Initialize(new SharedApplication(), this, window)
// Add view to container as usual
MXTouchContainer.AddView<ModelTab1>(typeof(Tab1View),ViewPerspective.Default);
MXTouchContainer.AddView<ModelTab2>(typeof(Tab2View),ViewPerspective.Default);
MXTouchContainer.AddView<ModelOther>(typeof(OtherView),ViewPerspective.Default);
// Create a MXTouchViewGroup, with items representing tab items
MXTouchViewGroupItem[] menuItems = new MXTouchViewGroupItem[] {
new MXTouchViewGroupItem(typeof(Tab1View),"Tab 1!",""),
new MXTouchViewGroupItem(typeof(Tab2View),"Tab 2!",""),
};
MXTouchViewGroup tvg = new MXTouchViewGroup(new MXTouchViewGroupTabController(),menuItems);
// Add the group to MXTouchContainer.ViewGroups
List<MXTouchViewGroup> ltvg = ((MXTouchContainer)MXTouchContainer.Instance).ViewGroups;
ltvg.Add(tvg);
// navigate to to starting location now
MXTouchContainer.Navigate(null,MXTouchContainer.Instance.App.NavigateOnLoad);
In the shared app, create controllers derived from MXController as usual and add them to the NavigationMap. Absolutely nothing special to be done in the "Shared Application"
In The MonoCross Container, you add views derived from MXTouch*View as usual to the container as usual as well. What is done differently is to create a "MXTouchViewGroup" with one "MXTouchViewGroupItems" created for each tab; each "MXTouchViewGroupItem" has one of your views associated to it. You'll want to create an appropriate "MXTouchViewGroup" item for your tab bar, and then add the group to your "MXTouchContainer" as shown, and then let the framework navigate to the first view as usual.
The result of all this is that when navigating to a view that is in a "group" (i.e. "Tab1View" or "Tab2View"), the framework will automagically render a tab bar with the view, without any further intervention. If you navigate to a view that isn't in a "group" (i.e. "OtherView"), the tabbar will not render.
That's it.
My app is a holiday search app. Once the user touch 'search' button it will do a web query and gather results from various providers such as BING, YAHOO, ETC... I want to show these results tabbed according to the provider. I want to use a table to show the list of results of one provider and a tabbar on the bottom of the screen to switch providers.
The number of providers is dynamic means it can ONLY be known once the web query is done. So number of tabs required/view controllers required is NOT known prior to the web request.
Any idea how to implement this ???. Since i'm bit new to IOS dev, I would be delighted if you can provide a detailed description. Thank you. Feel free to ask any question if you do not get my problem.
You add ViewControllers to a tab bar and it will display a tab for that view controller - so you would have to put each result set into a view controller and add them to the tab bar.
be aware a tab bar can only display 5 tabs before it switches to 4 tabs and a moreā¦ controller.
A possibly better way would be to have a button that brings up a UIPickerView which has a list of the result sources. that way you can have as many result sources as you like!