MonoCross Example using "MXTouchViewGroup*" in a MonoCross.Touch application - ios

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.

Related

How to destroy the side menu before move?

I use the side menu (jonkykong / SideMenu) when developing an application for iOS and ran into a problem. I need a menu that will be displayed on all ViewController, everything seems to work, but when you switch to the second controller, a new menu opens with the second controller, but the old menu. The only thing I found in the developer's questions is that it's necessary to destroy the old menu before switching to the second controller, but I have not found it anywhere. The code for my menu is exactly the same as in the example, except for the TableView in the menu itself (the list of menu items is implemented by tables) and the implementation of the standard functions of selecting on the table cell. I am hope for your help. Thank you very much.
Link to the side menu itself:
github.com/jonkykong/SideMenu
Photo1
Photo2

Xamarin forms Master detail Icon

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.

Vaadin navigation through views or UI?

I'm new in Vaadin. I did vaadin example http://demo.vaadin.com/addressbook/. My question is how I can also create another views and menu which will navigate user. Can I do it with MenuBar? Please explain me right way to do this.
I think everything you need is Navigator.
You can instantiate a navigator and attach it to your current page.
Then you attach views to it, with names.
And when you want to change view, you can simply call Page.getCurrent().getNavigator.navigate(String viewName)
See documentation for more informations.

navigation with login page

I implemented simple application according of example simple login view. Where we have login-view and main-view. But now, how I can implement on main-view MenuBar where every Items when clicked open different views. And those views are under MenuBar in same place (center on the page under MenuBar, on sample) in main-view. I tried with additional navigator(which name can be subNavigator) in main-view but we must register navigator in UI(I have got appropriate error). Second solution is that I create UI and in init method ManuBar and under it change every views(login-view, view1, view2 etc). But login-view have ManuBar and it is do not looks good. Is there any other way or are other ways to achieve something similar?
Your question is not at all clear. I suggest re-writing it. Perhaps with a sketch image.
TabSheet
Are you aware of the TabSheet widget? An easy way to switch between panes of content.
See the Book Of Vaadin, the class doc, and the live demo.
Also, look at TabSheet in the Reindeer theme as shown in this demo.

asp.net mvc 2 menus between 4 controllers

I want to have 2 navigation menus- One will be a "Top Level" menu, with 4 choices, each pointing to the index of a separate controller.
I would like to have a "Controller-Level" sub-menu on the left of my screen. This will correspond to links relevant to the controller selected in the top menu.
The "controller-level" menu is not static and needs to be customized based on roles of user.
The top-level one is basic. But how can i create the second menu that will change when a controller is selected from top?
danke!
I'm working on a similar situation where I need two menus. Was a "best-practice" ever resolved here? I have the need for one menu on the left, and a dynamically created tab-like menu at the top depending on what page I'm working with/on.
The user actually needs the ability to add/remove/hide top tabs depending on preferences. We are using MVC 2 and I'm not sure if the tab bar belongs in a control, on individual views, or what...and also how to make them both interact with my pages. (The left nav needs to show where the user is at all times, and the top tab needs to be highlighted based on the sub-page the user has selected.
If you are using MVC 2 RC or MVC Futures, then use RenderAction.
Create a controller for the dynamic menu, and call RenderAction("action", "controller"). This will invoke the controller, and you can have your logic in the controller to show the correct menu.

Resources