Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrismNavigationPage doesn't allow you to change navbar title color #3134

Closed
sact1909 opened this issue May 9, 2024 · 3 comments
Closed

PrismNavigationPage doesn't allow you to change navbar title color #3134

sact1909 opened this issue May 9, 2024 · 3 comments

Comments

@sact1909
Copy link

sact1909 commented May 9, 2024

Description

in your documentation you said, PrismNavigationPage will be registered as the default navigation page in case we don't have a custom navigation page, but also you mention this

My current version (but it happen with any version not matter what)
.NET MAUI 8
Prism.DryIoC.Maui = 9.0.401-pre

image

that's why I would like to keep the PrismNavigationPage as default, but this doesn't allow you to change the navbar title color, no matter what you do, it will be black

this is how my PrismStartup,cs looks
image

this is how my Resources/Styles/Styles.xml looks (I'm forcing the bartextcolor to be red in any scenario)
image

and it still black
image

Please download the Sample Project (is the same that I use for the images)
PrismNavigationPageBug.zip

Steps to Reproduce

  1. Create a New Project using the Prism Template Projects
  2. Go to Resources/Styles/Styles.xml
  3. Search for the style section with TargetType=NavigationPage
  4. Set the BarTextColor property to whatever color, in my case I use Red
  5. Run the Project (and the bartextcolor in the navbar will be still in color black)

Platform with bug

.NET MAUI

Affected platforms

Android

Did you find any workaround?

Obvious If register the NavigationPage in the PrismStartup.cs it will work,
image

but it is supposed to be there when you don't have any other custom NavigationPage, that what you say

Relevant log output

No response

@AmrAlSayed0
Copy link
Contributor

Add Style.ApplyToDerivedTypes to your NavigationPage style or just target the PrismNavigationPage directly. I think that will solve your issue.

Also this is not specific to Prism. Any derived types will not have the styles applied without Style.ApplyToDerivedTypes.

@sact1909
Copy link
Author

sact1909 commented May 11, 2024

Add Style.ApplyToDerivedTypes to your NavigationPage style or just target the PrismNavigationPage directly. I think that will solve your issue.

Also this is not specific to Prism. Any derived types will not have the styles applied without Style.ApplyToDerivedTypes.

@AmrAlSayed0
I never thought it was a prism problem, but is something that happens with a prism class, I think that there could exist a Prism solution for this, setting that property as default anywhere

but glad to see that property, never seen it before, really appreciate that info, it helped me a lot

note:
I tried to target the PrismNavigationPage directly but that doesn't work, maybe this could be another workaround for Prism if the allow to target the PrismNavigationPage

Thanks for the help

@dansiegel
Copy link
Member

closing this as the issue is due to the fact that your style is explicitly on a NavigationPage and could be fixed by:

  1. applying it to PrismNavigationPage
  2. applying it to derived types ApplyToDerivedTypes="True"

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

No branches or pull requests

3 participants