Xamarin.Forms icon indicating copy to clipboard operation
Xamarin.Forms copied to clipboard

[Bug] ToolbarItems not shown on shell modal page

Open Centurys opened this issue 4 years ago • 9 comments

Description

When using Shell template, I would like to use ContentPage.ToolbarItems declaration on content pages to add some commands. ContentPage.ToolbarItems toolbar at the top is not visible on modal page. Is this by design? Can I somehow manually render ContentPage.ToolbarItems with some custom xaml?

Steps to Reproduce

  1. Create Shell app.
  2. Navigate to modal with code behind: Shell.Current.Navigation.PushModalAsync(new Page2());
  3. Add to modal content page Page2 xaml code: Shell.NavBarIsVisible="True"

<ContentPage.ToolbarItems> <ToolbarItem Text="Example" /> </ContentPage.ToolbarItems>

Expected Behavior

ContentPage.ToolbarItems is visible

Actual Behavior

None ContentPage.ToolbarItems, Shell.TitleView, Shell.BackButtonBehavior are visible.

Screenshots

image

Basic Information

  • Version with issue: 5.0.0.1905
  • Platform Target Frameworks:
    • Android: 10.0

Environment

Show/Hide Visual Studio info
Microsoft Visual Studio Professional 2019
Version 16.8.4
VisualStudio.16.Release/16.8.4+30907.101
Microsoft .NET Framework
Version 4.8.03752

Installed Version: Professional

Visual C++ 2019   00435-60000-00000-AA701
Microsoft Visual C++ 2019

ASP.NET and Web Tools 2019   16.8.557.25636
ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services   16.1.0.2052803+84e121f1403378489b842e1797df2f3f5a49ac3c
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2019   16.8.557.25636
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   16.8.557.25636
Azure App Service Tools v3.0.0

C# Tools   3.8.0-5.20604.10+9ed4b774d20940880de8df1ca8b07508aa01c8cd
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

CodeMaid   11.2.231
CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, R, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

EditorConfig Language Service   1.17.284
Language service for .editorconfig files.

EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs.

Extensibility Message Bus   1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

File Icons   2.7
Adds icons for files that are not recognized by Solution Explorer

ILSpy.AddIn   1.0
Integration of the ILSpy Decompiler into Visual Studio.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers   1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   16.8.43 (00471f8)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   5.8.1
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Open Command Line   2.4.233
2.4.233

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Syntax Highlighting Pack   2.8.134
Adds syntax highlighting and snippet support for a wide variety of programming languages such as Clojure, Go, Jade, Lua, Swift, Ruby and many more...

SQL Server Data Tools   16.0.62012.31170
Microsoft SQL Server Data Tools

TypeScript Tools   16.0.21016.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.8.0-5.20604.10+9ed4b774d20940880de8df1ca8b07508aa01c8cd
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   16.8.0-beta.20507.4+da6be68280c89131cdba2045525b80890401defd
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Foo   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

VSColorOutput   2.73
Color output for build and debug windows - https://mike-ward.net/vscoloroutput

Xamarin   16.8.000.261 (d16-8@bb99248)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   16.8.0.507 (remotes/origin/d16-8@e87b24884)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   16.8.112 (86385a3)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   11.1.0.26 (d16-8/a36ce73)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: 5e9cb6d
    Java.Interop: xamarin/java.interop/d16-8@79d9533
    ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
    SQLite: xamarin/sqlite/3.32.1@1a3276b
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc


Xamarin.iOS and Xamarin.Mac SDK   14.8.0.3 (c51fabee8)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Centurys avatar Jan 20 '21 21:01 Centurys

This also happens with TitleView - no items appearing - so probably related.

bcaceiro avatar Jan 21 '21 12:01 bcaceiro

I have this issue but as @bcaceiro said with the TitleView on any page

Rabosa616 avatar Jan 22 '21 15:01 Rabosa616

hi guys. @PureWeen noticed this has been moved to to-do. Is there any timeline on this or a workaround?

I am trying to migrate to shell and this has left me completely stumped with title views (amongst other things). For modal, we have these three issues stated, for tabbed pages we have the issue that the view is not correctly aligned.

rysbilinski avatar Mar 10 '21 10:03 rysbilinski

@rysbilinski for modal page as workaruond I did similary looking layout (custom xaml on that page), like toolbar looks not on modal pages.

Centurys avatar Mar 17 '21 17:03 Centurys

Anything happening on this issue? It's a bit troublesome to workaround this.

damsad avatar Aug 18 '21 07:08 damsad

I have the same issue and the following workaround works for me (on iOS, not tested in Android): Shell.Current.Navigation.PushModalAsync(new NavigationPage(new Page2()));

scastiello avatar Oct 20 '21 09:10 scastiello

thanks @scastiello for the work-around! btw it works on android as well. however, this is really frustrating that, for example, page title has to be manually created with a custom Shell.TitleView for a modal page. I fully embraced shell navigation and have fully re-designed my app in terms of navigation, but now I'm struggling to understand why modal pages can't have a normal <ContentPage Title..... shown on them (without back button of course). Xamarin, can we please have modal pages working the old way?

barmouta avatar Dec 31 '21 04:12 barmouta

hello, is this issue fixed ? i have the same issue currently.

jmeyerworms avatar Jul 23 '23 19:07 jmeyerworms

waiting for a fix ...

awaescher avatar Jan 16 '24 20:01 awaescher