Forum Xamarin.Forms

ContentPage.ToolbarItems and NavigationPage.TitleView with UWP project

davedave Member ✭✭
edited May 2019 in Xamarin.Forms

When I use NavigationPage.TitleView block to set a page title, my toolbar icons in ContentPage.ToolbarItems block are pushed to the Secondary menu. This happens only with UWP project while the Android project behaves as expected.

If, however, I move the UWP ToolBar to the bottom in the Application wide App.xaml.cs with the following

MainPage.On<Windows>().SetToolbarPlacement(ToolbarPlacement.Bottom);

it works as expected, except that the top Toolbar is still there as a blank. However, for consistency, I would like the ToolBar to remain in the Top.

Are NavigationPage.TitleView and ContentPage.ToolbarItems mutually exclusive for UWP project, or am I missing something such as disabling some of the UWP features such as its native CommandBar control?

PS: XF is ver 3.4.0.1008975

Best Answer

Answers

  • davedave Member ✭✭

    Thank you @ColeX for a quick reply.

    If this is by design, surely looks unhelpful. The only edge-use case where I can see this of help is where you need a page title without a menu. In fact, I am using one now. My top page has a toolbar icons with a navigation to a Settings page. For the later I need no toolbar items; I just navigate to, set options and return, but the page title Settings is good to have.
    But, for the top page, I cannot have a page title and NavigationBar with ToolBar items in it.

    Yes, I can define page title directly with ContentPage using Title property but I cannot set the FontSize and other styles as I can do with a Label Control in NavigationPage.TitleView (I suppose we can't have everything!).

    That is not the end of it. Even if I do not use NavigationPage.TitleView in my top page, navigating to another page (in the above example, my Settings page) that uses NavigationPage.TitleView and navigating back to the top page will have the same effect. That is, the effect is there even for NavigationPage.TitleView in another page as long as that page is navigated to. Really strange.

    As you suggest I will forward my findings to the link you provided. Thanks again.

  • SagarPanwalaSagarPanwala USMember ✭✭✭

    Any update on this ? I thought Titleview will occupied space , what Title in Toolbar in Android does. If there is more space in Title Android shows up Toolbar Items. But here Forms is hiding them, which looks like bug in Xamarin Forms.

Sign In or Register to comment.