I want to show the title of current page on the top bar. I couldn’t find a generic way to do this so I managed this manually through the DataContext that is passed to the clicked handler like this:
The Navigation= binds it to the desired navigation and the {Page Title} is the lookup of a resource in that page, where Title is mapped to the title.
This was tested primarily on PageControl, but I think it should work on Navigator as well (if not then we need to correct it).
From JS we have a pending issue to make the Active part of navigation 2-way bindable, which would give you some limited introspection into the current page.
HistoryChanged isn’t what you want. I’m not sure that is even meant to be public.
It works with PageControl but it doesn’t work with Navigator. It gives the following error:
The node 'mainNav' can not be used here: The type must be compatible with 'Fuse.Navigation.IBaseNavigation' - /Users/ipek/Documents/workspace/fuse/_test-cases/PageTitleInNavigation/MainView.ux(6:1):E
Object reference not set to an instance of an object - (0:0):E
I wasn’t sure what I should write to the Navigation property of top StackPanel: I tried Router's name at first. It didn’t give error but it also didn’t work. Then I used PageControl's name and it worked for PageControl.
Here is the test App:
I’ve prepared this small app in order to explain my need more clearly. The navigated page names could have been more intuitive Sorry that I couldn’t made them better.
I need to set the currentPageTitle Observable variable to show the current page’s title in the top panel.
I also need this information in order to know the state I’m in, for bussines logic wise (in that case I won’t use PageTitle of course ).
I’m looking for a solution that has an event bound/ trigger callback handler kind of logic: Not something that I’ve to manually update currentPageTitle value in every function call.
Does Fuse have any mechanism like this in current version?
The way I worked around this limitation was to create a separate component for top bar, and this component has a Title property. On each page, I simply add the component with a custom title. It will be nice if this actually starts working with the Navigator.