Reuse menuBarTemplate across views - tvos

I'm trying to create a simple TVML based app for tvOS. I'm having a problem to wrap my head around how the templating of the menu bar is supposed to work.
Let's assume my tab1.tvml looks like this:
https://developer.apple.com/documentation/tvml/layout_elements/menubar
And I have one other template called tab2.tvml that only has the text "Hello World" in it. When I start my app tab1.tvml is correctly shown with the menu bar. With my actionHandler it's also switching to tab2.tvml if I select it in the menu bar.
Simplified version of my action handler:
function handleMenuBarEvents(event) {
var doc = resourceLoader.getDocument("tab2.tvml");
navigationDocument.pushDocument(doc);
}
But the question is:
How do I "inherit" the menu bar so it's shown on all views when I swipe down like it's in other tvOS apps? Do I have to copy my menu bar into all views and update them everywhere if I decide to add a new menu tab?
Thanks!

Related

How to get a multi-level menu work in hugo with theme "dot"?

I'm currently building a web site with hugo using the theme "dot" and having trouble regarding the menu.
Now I want to have a menu at the top of the page with main menu points and opening sub menus when hovering over the main entries. So far, so good no problem, that is easy using the config file defining the menu in there. But, the main menu points are not clickable when naming the ".md" files after their meaning. When I name the main entry points "index.md" in their specific folder then I get other problems like not properly working sub menu entries.
An appropriate option would also be to have a main menu at the top of the page and when clicking on an item apart from the contents of that specific main menu item, a side navigation menu opens up and shows the menu items of that specific main menu (not just all menu items). I don't know how to implement this as the specific content pages are ".md" files.
Thanks in advance for any help!
Best regards,
Jochen

Appmaker: Handle several copies of a page fragment as one?

I have a SideMenu page fragment in my app. On each and every page, I have a copy of this page fragment.
My intention was to create a SideMenu with openable SubMenus (only one sub menu could be open at a time), but I could not get it done to make the app "remember" the state of the SideMenu( like which SubMenu should be open, and which ones shouldn't), because on each site there is a different widget, so when in my code ( in my onClick events) I refer to the widget, I am not handling "a global SideMenu" but rather a specific copy of it, unique to that page.
Sadly, this took several hours of debugging to realize, I am defeated.
Is there anyway to place a page fragment on a page, so I can handle that widget on its own, not just it's copies?
Thanks in advance, I can try to specify more the question if it's needed.
I agree with #MarkusMalessa. You need to invoke the widget on every page and then apply whatever change on it. I am doing the samething on a project in which I intend to shrink and expand the sideMenu. To give you an idea, evertime I click a button on the side menu responsible for the logic, this is the code that's invoked:
var pages = app.pages._values;
pages.forEach(function(page){
var sideMenu = page.descendants.sideMenu1;
if(sideMenu){
if(widget.text === "chevron_right"){
sideMenu.getElement().style.width = "300px";
} else {
sideMenu.getElement().style.width = "60px";
}
}
});
That way every sideMenu widget inside each page that has it receive the same changes.

Avoid ionic side menu from close when click on it

I'm developing with Ionic Framework an app where the main view is a map (working with Leaflet). And in the side menu, there are some forms in order to allow differente searches on the map (shortest path between 2 points...).
The thing is, every time I click in one of the inputs (text, checkbox...) of the forms, the side menu closes.
Is there anyway to avoid that? It is possible that the side menu only closes and shows when I tap in the 'burguer' button?
It's as simple as remove the 'close-menu' class from all the 'ion-item' elements inside the ion-side-menu

Load a XAML page in another XAML page

I need some help on a Windows Phone 8 app I am currently working on.
On the left side, I want a menu, if I click an item, I need to land on the corresponding page.
When the app opens, I see this menu and a bit of the next page.
I can switch between the menu and the full page with a button in the corner.
So far, so good.. I was able to build this and code a news page on the right to test this.
But then.. if I need to load another page, I'm in trouble, because my design at this moment
is a single XAML page that scrolls.
My question is this: Is there a way to load a XAML page in another XAML page?
Will this work with bindings?
Another option would be to put all the XAML for all menu items in place and only show
the things I need for a certain menu item (that feels quite wrong).
Or am I totally missing something?
All help would be very much appreciated, as I'm a new to developing for Windows Phone.
I added a simple drawing, which I hope can explain what I'm trying to.
You can add controls in c#.
namespace MyNamespace
{
public partial class SomePage: PhoneApplicationPage
{
public SomePage()
{
InitializeComponent();
LayoutRoot.Children.Add(new TextBlock()
{
Name = "MyTextBlock",
Text = App.ViewModel.Item[0].SomeProperty
});
}
}
}

Menu Items in Windows 8?

Am trying to design my metro app like, In my homepage I need to display list of items in a menu on the left side of page and when we click on each item,every item will need to navigate separate page and contains some data.Can anyone suggest me which control should you I take to start my scenario?Working examples are really helpful to me.
Thank you.
Navigation in a WinRT App doesn't use the Menu/Menu-Item metaphor. You can add an App Bar that swipes up from the bottom of the screen that you place contextual controls such as buttons related to the current page or selected item(s). You can also add global settings to the Settings charm that swipes in from the right.
What you are describing sounds like the "Split App" template that comes out of the box with Visual Studio 2012. It consists of a list of items along the left-hand side of the screen which, when selected, change the content on the right-hand side of the screen. Try creating a new Split App and see if that helps.
This is not a completed worked example, but I would recommend looking at two items:
MSDN Documentation for WinJS.Navigation
MSDN Sample for navigation application
These should get you the solution you need -- the sample is quite complete, and can be tailored to your needs.
It sounds to me like what you are talking about is the SplitApp view. Check out this link, the second template listed, just below GridView:
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh768232.aspx
You'll find that in Modern/Metro things like menus are handled through contextual listviews in the window content area, or through charms (read icons) on the AppBar. Many people hear menu now and cringe, just due to the style guidelines for Chrome/Menu free applications.
If you don't want the content to display next to the links, as the SplitApp view does, you should consider a regular listview for your links, styled however you like and set to display vertically, with click events that take you to whatever detailed page view you want to go to. Navigation is dead simple in a Metro App.
C# Example:
this.Frame.Navigate(typeof(MyDetailPage),myContentId);
Then on your details page, you can get the argument when it's navigated to:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
var myContentId = e.Parameter;
...
}
And if absolutely none of the above was helpful, try checking out these examples. I know you probably aren't making an RSS reader, but they will take you through the basics of the various views and navigation.
Create a blog reader with C#/VB & XAML:
http://msdn.microsoft.com/en-us/library/windows/apps/br211380.aspx
Create a blog reader with JS & Html5:
http://msdn.microsoft.com/en-us/library/windows/apps/hh974582.aspx