locked
UWP mysterious Command Bar RRS feed

  • Question

  • User281279 posted

    Hello guys,

    I have really strange problem in one of my projects. In my UWP project a mysterious command bar appears above my pivot headers. And I don't know where did it come from and how to remove it. I managed to find it in the Live Visual Tree and when I set its "Visibility" property to "Collapse" it disappear. But I don't know how to make it disappear with C# code.

    I'm attaching an image of my problem. I will be very grateful if someone can help me with this!!!

    Best Regards, K. Petkov

    Thursday, March 2, 2017 4:29 PM

Answers

  • User76049 posted

    @KrisPetkov

    Sorry, I was wrong earlier, pre 4 resolves toolbar items in masterdetail pages and navigationpage wrapped modal pages too.

    For some reason pre-2 wasn't cleared from my UWP project, had to remove forms completely.

    I don't target desktop so I've only tested on windows mobile hardware.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, March 14, 2017 4:56 PM
  • User281279 posted

    Well, guys I can confirm that it is working in 2.3.4.214-pre4 and even tested it with 2.3.4.214-pre5 and it is O.K. I hope that there will be no more regressions and it will continue to work as expected.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, March 15, 2017 3:24 PM

All replies

  • User89714 posted

    @KrisPetkov - Looks like the NavigationBar. If in your App.xaml.cs you have code that assigns a NavigationPage instance to MainPage, try the following:

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

    That'll move it to the bottom if it is the navigation bar.

    In practice, you're likely to want to set the following on your NavigationPage:

    BackgroundColor
    BarBackgroundColor
    BarTextColor
    Text
    
    Thursday, March 2, 2017 4:37 PM
  • User281279 posted

    @JohnHardman - Thank you for the answer! But it seems that this is not the problem. I did try your suggestion but it didn't help. Before this page I have two more pages and there is no such problem. Only on this one. FYI: this is a MasterDetailPage with TabbedPage as a Detail fragment/page. On iOS and Android everything is OK only UWP shows this ridiculous empty space at the top...

    Thursday, March 2, 2017 4:59 PM
  • User89714 posted

    @KrisPetkov - Ok, didn't realise it was Master/Detail. Do you have your Master page wrapped in a NavigationPage?

    You might want to look in Bugzilla too - there are some UWP issues related to Master/Detail.

    Thursday, March 2, 2017 5:19 PM
  • User281279 posted

    @JohnHardman - Just checked one more time for Navigation page wrapping Master/Detail but there isn't any. I'll check in Bugzilla for some answares. If i find the solution I'll post it here.

    Thursday, March 2, 2017 6:09 PM
  • User92861 posted

    It's most likely this MasterDetailPage bug that you're hitting. I have a PR in the repo open for a fix, but unfortunately I don't know a workaround for it. The last known build that doesn't have this issue is 2.3.3.168.

    Thursday, March 2, 2017 9:58 PM
  • User76049 posted

    @JimmyGarrido

    Forms 2.3.4 Pre2 breaks platform specifics for UWP. My toolbar icons no longer appear in UWP (worked fine in 2.3.3)

    <?xml version="1.0" encoding="utf-8" ?> <NavigationPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Foobar.Views.MainNavigationPage" xmlns:windows="clr-namespace:Xamarin.Forms.PlatformConfiguration.WindowsSpecific;assembly=Xamarin.Forms.Core" windows:Page.ToolbarPlacement="Top" Title="MainNavigationPage"> </NavigationPage>

    Any chance you could look into this or let the Forms team know there's a regression bug in 2.34?

    Thursday, March 2, 2017 10:09 PM
  • User92861 posted

    @NMackay Hey Norman! Bugzilla is the best way for us to track regressions so file a quick report (you can just paste the code in the description) and I'll take a look at it there. Thanks!

    Thursday, March 2, 2017 10:27 PM
  • User76049 posted

    @JimmyGarrido

    I'm beginning to actually hate UWP, it causes nothing but problems.

    I created a repo in 2.3.4-pre2 and of course the icons would have to show up in that project with the same XAML :neutral:

    Exact same components, pcl profile etc. The amount of time we've wasted reproducing UWP issues and working round them, just to save $60 dollars over handing out an android (I suggested Android) we've lost so much more in lost man hours :s

    I removed every single nuget package from the solution (14 projects) and added them all again but no difference.

    Monday, March 6, 2017 3:47 PM
  • User76049 posted

    @JimmyGarrido

    The weird thing is, if you take out the platform specifics stuff I still get no toolbaritems, they should appear at the bottom but instead I get no toolbar items.

    Monday, March 6, 2017 3:58 PM
  • User76049 posted

    @JimmyGarrido

    Never mind, it's the same bug, I wasn't testing with MasterDetail in my repo.

    https://bugzilla.xamarin.com/show_bug.cgi?id=51802

    Surely they can't ship 2.3.4 with this bug? (at least I cleaned up my nuget packages)

    Monday, March 6, 2017 4:00 PM
  • User76049 posted

    @JimmyGarrido

    I've attached a repo project to that bug, this issue effectively means you won't get toolbar items in a contentpage if it's hosted in MasterDetail.

    I'll rollback to 2.3.3.190 (although that means refactoring XAML and code) so we can get on with some dev but I really hope this gets fixed before 2.3.4 is released as it will affect a lot of users.

    Monday, March 6, 2017 4:18 PM
  • User281279 posted

    @JimmyGarrido & @NMackay

    After your answers guys I read more about this bug and did try it by myself and its not working after 2.3.3.168. Even with 2.3.4-pre2 it's not OK at all. I hope that they will fix it in the next release because it's really annoying. The strange thing is that 3 version builds after 2.3.3.168 the bug is still here

    Monday, March 6, 2017 4:30 PM
  • User76049 posted

    @JimmyGarrido @KrisPetkov

    Rolling back to the latest stable brings back the toolbar buttons in UWP, it won't resolve the issue Kris mentioned though. I don't know if they are the same bug?

    Monday, March 6, 2017 5:27 PM
  • User92861 posted

    @KrisPetkov There were some changes after 2.3.3.168 that are causing this issue. I have a pull request open that should fix this but it still needs to be reviewed and merged into master so it is not available on any release currently.

    @NMackay The issue you are describing with the ToolbarItems sounds like it might be this bug instead. However the issues are related and the PR I mentioned above should also resolve this.

    Monday, March 6, 2017 5:38 PM
  • User76049 posted

    @JimmyGarrido

    Thanks for getting back. It's nice someone is still listening to us :smile:

    It may well be that one, I get no toolbar buttons at all though my app in a masterdetail scenario in 2.3.4 pre2, that user was reporting he was seeing the toolbar buttons after 1st detail page navigation

    Monday, March 6, 2017 5:42 PM
  • User263 posted

    Worst case with UWP, you can resort to direct manipulation of the visual tree with a custom renderer. You just have to build some nice tree traversal methods and make good use of the Live Visual Tree explorer.

    We had to do this on a couple of occasions before a number of XF fixes became available. Its a little messy, but possible!

    Monday, March 6, 2017 11:26 PM
  • User76049 posted

    @JimmyGarrido

    Thanks for looking int this.

    :)

    Tuesday, March 7, 2017 12:03 AM
  • User76049 posted

    @JimmyGarrido

    I can confirm Pre4 does not resolve this issue.

    Tuesday, March 14, 2017 11:00 AM
  • User76049 posted

    @KrisPetkov

    Sorry, I was wrong earlier, pre 4 resolves toolbar items in masterdetail pages and navigationpage wrapped modal pages too.

    For some reason pre-2 wasn't cleared from my UWP project, had to remove forms completely.

    I don't target desktop so I've only tested on windows mobile hardware.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, March 14, 2017 4:56 PM
  • User281279 posted

    @NMackay

    Thank you for the information! I will test it tomorrow and I'll write here to confirm that it is O.K.

    Tuesday, March 14, 2017 5:02 PM
  • User281279 posted

    Well, guys I can confirm that it is working in 2.3.4.214-pre4 and even tested it with 2.3.4.214-pre5 and it is O.K. I hope that there will be no more regressions and it will continue to work as expected.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, March 15, 2017 3:24 PM
  • User296555 posted

    :D ~=Broken again=~ :D

    Wednesday, December 20, 2017 3:58 AM
  • User176749 posted

    @AceCoderLaura said: :D ~=Broken again=~ :D

    how did you achieve such masterdetail like native navigationview? I mean you have leftCollapsed display with icons only i guess. this doesnt seem to be possible with xamarin.forms masterdetail. did you use native tools?

    Tuesday, February 5, 2019 3:56 PM