Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] Shell Tab Title property don't change value respect the binding declaration #10877

Open
ncarandini opened this issue May 28, 2020 · 3 comments

Comments

@ncarandini
Copy link

Description

Can't bind the Shell Tab Tittle property to a ViewModel property.

Steps to Reproduce

I've made a GitHub project that repro the issue: ncarandini/XFShellBug

  1. Bind Title and Icon to VM properties:
<Shell.BindingContext>
    <vm:AppShellViewModel/>
</Shell.BindingContext>
...
<Tab Title="{Binding LogInOutTitle}" Icon="{Binding LogInOutIconName}">
    <ShellContent ContentTemplate="{DataTemplate views:LoginPage}" />
</Tab>
  1. Somehow change the values of LogInOutTitle and LogInOutIconName at runtime:
public string LogInOutTitle => !((App)Application.Current).IsUserLogged ? "Login" : "Logout";
public string LogInOutIconName => !((App)Application.Current).IsUserLogged ? "tab_login.png" : "tab_logout.png";

Expected Behavior

The Title and Icon of the Shell Tab element shall change following the XAML binding declaration.

Actual Behavior

The Icon changes accordingly but the Title don't.

Basic Information

  • Xamarin.Forms: 4.6.0.800

Screenshots

image

Reproduction Link

I've made a GitHub project that repro the issue: ncarandini/XFShellBug

@ncarandini ncarandini added s/unverified New report that has yet to be verified t/bug 🐛 labels May 28, 2020
@jsuarezruiz jsuarezruiz added a/tabbedpage and removed s/unverified New report that has yet to be verified labels Jun 1, 2020
@denzerd
Copy link

denzerd commented Jul 28, 2020

+1
It is impossible for us to apply our InApp Translation to the Shell because the Binding is defined as OneTime.

@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@samhouts samhouts removed this from the 5.0.0 milestone Nov 2, 2020
@jfversluis
Copy link
Member

jfversluis commented Aug 13, 2021

For the code in the repro you can set the Binding Mode to OneWay or TwoWay manually and then it works, i.e.:

<Tab Title="{Binding LogInOutTitle, Mode=OneWay}" Icon="{Binding LogInOutIconName}">
    <ShellContent ContentTemplate="{DataTemplate views:LoginPage}" />
</Tab>

@dinesh4official
Copy link

@jfversluis , If we bind the DataTemplate through binding in ContentTemplate and change the template at runtime, it is not updated. I looked into the source code and the PropertyChanged is not invoked for ContentTemplate bindable property and so it won't get update. Is there any way to update the new template at runtime?

Thanks

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

No branches or pull requests

6 participants