Skip to content

[Droid][WASM] CommandBar isn't visible #1509

Closed

Description

@crogeniks

Current behavior

The Command bar doesn't show up properly in WASM and Android

  • WASM
    -- Command bar is visible, but Icons are clipped(not 100% reproducible)
    --
    image
    -- Opening the Secondary Commands does "nothing" and freeze the CommandBar

  • Android
    -- Command bar is visible, but shows the Secondary Commands
    --
    image

Expected behavior

  • WASM
    -- don't freeze after opening the secondary commands

  • Android
    -- Show all AppBarButtons

How to reproduce it (as minimally and precisely as possible)

Sample project :
CommandBar.zip

Environment

Nuget Package:

Package Version(s):

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • Windows
  • Build tasks

Visual Studio

  • 2017 (version: )
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins

  • Resharper (version: )

Anything else we need to know?

Activity

  1. added
    kind/bug
    triage/untriaged
    on Sep 9, 2019
  2. added
    platform/android 🤖
    platform/wasm 🌐
    and removed
    triage/untriaged
    on Sep 10, 2019
  3. ghuntley commented on Sep 10, 2019

    @ghuntley
    Member

    Howdy @crogeniks.

    The clipping on symbols on WebAssembly is likely related to #1332 or #693. Maintenance of glyphs is currently quite manual and there's a issue open over at #967 to automate the processes.

    In case you missed it - CommandBar has two modes, on Android it can't be fully customized like other templatable controls would. By switching to XamlDefaultCommandBar you can replicate UWP's CommandBar. It is templatable and supports a template that's almost identical to UWP's default CommandBar.

    Thanks for providing a repro, will need to revisit this at a later date as we are busy preparing for UnoConf. I see you are from Montreal - will see you there?

    ps. The following are worth checking out if you intend to send in a pull-request:

  4. pkar70 commented on Sep 10, 2019

    @pkar70
    Contributor

    How can I change CommandBar mode to XamlDefaultCommandBar?

  5. pkar70 commented on Sep 10, 2019

    @pkar70
    Contributor

    And, in SecondaryCommands, AppBarToggleButton is not shown (only AppBarButton). At least in Android.

  6. TopperDEL commented on Sep 10, 2019

    @TopperDEL
    Contributor

    How can I change CommandBar mode to XamlDefaultCommandBar?

    I've asked me the same Question just a second ago. The documentation talks About different modes, but it is not clear how to set them.

  7. ghuntley commented on Sep 10, 2019

    @ghuntley
    Member

    How can I change CommandBar mode to XamlDefaultCommandBar?

    That's good feedback — have raised issue to improve clarity of the documentation. The modes can be switched between by changing the control templates.

    <Style TargetType="CommandBar" BasedOn="XamlDefaultCommandBar" />
    
    <Style TargetType="CommandBar" BasedOn="NativeDefaultCommandBar" />
    

    The default modes for Uno are configured via

    if (Uno.UI.FeatureConfiguration.Style.UseUWPDefaultStyles)

  8. pkar70 commented on Sep 10, 2019

    @pkar70
    Contributor

    But...
    <Page.Resources>
    <Style TargetType="CommandBar" BasedOn="NativeDefaultCommandBar" />
    </Page.Resources>

    ends with:
    Implicit styles in inline resources are not supported (Page, Line 1:2)

    So, where to place this Style?

  9. davidjohnoliver commented on Sep 10, 2019

    @davidjohnoliver
    Contributor

    @pkar70 You need to put it in a standalone ResourceDictionary file or in Application.Resources.

  10. TopperDEL commented on Sep 10, 2019

    @TopperDEL
    Contributor

    This is still not working for me. It keeps saying "The property Binding.BasedOn is unkown."

  11. pkar70 commented on Sep 12, 2019

    @pkar70
    Contributor

    Seems like (on Android) only buttons with image icon are supported, at least within CommandBar (as AppBarButton with FontIcon is supported, but CommandBar implementation doesn't use AppBarButton implementation).

    I changed CommandBar to AppBar with StackPanel full of AppBarButtons and it works*. Although for SymbolIcon you have to apply workaround (till next Uno.Ui release), changing it to FontIcon:

    e.g. change

    <AppBarButton Icon="Refresh" Label="Wczytaj" />

    to

    <AppBarButton Label="Wczytaj" >
    <AppBarButton.Icon>
    <FontIcon Glyph="&#xE14A;" FontFamily="ms-appx:///Assets/Fonts/winjs-symbols.ttf#Symbols" />
    </AppBarButton.Icon>
    </AppBarButton>`

    *) almost works, as it displays probably "..." icon on right, and this icon doesn't work.

  12. HaoLife commented on Sep 23, 2019

    @HaoLife

    This is still not working for me. It keeps saying "The property Binding.BasedOn is unkown."

    NativeDefaultCommandBar needs conditional compilation, he only supports ios and Android

  13. scpc0609 commented on Oct 20, 2019

    @scpc0609

    If I use the below code, it does not compile and code generation fails.
    <Style TargetType="CommandBar" BasedOn="NativeDefaultCommandBar" />

    If I use the below code, it does compile but crashes the App at start.
    <xamarin:Style TargetType="CommandBar" xamarin:BasedOn="{StaticResource XamlDefaultCommandBar}"/>

    I get exception at runtime: "The resource XamlDefaultCommandBar cannot be found".

    What is the proper way to enable XamlDefaultCommandBar.

    Also is there a guidance for people who want to create their own implementation of CommandBar without using any of the two variants available?

  14. modified the milestone: 3.1 on Aug 29, 2020
  15. added
    project/layout 🧱
    on Sep 21, 2020
  16. added
    difficulty/tbd
    on Feb 15, 2021
  17. added
    difficulty/medium 🤔
    and removed
    difficulty/tbd
    on May 31, 2021
  18. added
    area/commandbar
    on Jun 8, 2021
  19. added
    triage/potentially-fixed
    on May 31, 2023
  20. removed their assignment
    on Jun 7, 2023
  21. ramezgerges commented on Aug 7, 2023

    @ramezgerges
    Contributor

    This isn't reproducing for me on Android or WASM, although there is a (probably separate) clipping issue that I just opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/commandbardifficulty/medium 🤔kind/bugplatform/android 🤖platform/wasm 🌐project/layout 🧱triage/potentially-fixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions