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

Binding TabItem.Title property to ViewModel property throws exception #720

Open
BeepBeepBopBop opened this issue Jul 20, 2024 · 3 comments
Labels
bug-verified A bug that can be reproduced control-tabview

Comments

@BeepBeepBopBop
Copy link

BeepBeepBopBop commented Jul 20, 2024

Hello, I am trying to bind the title of a tab item to a property but this does not work.

The following exception gets thrown:
{"Operation is not valid due to the current state of the object."}

You can reproduce the issue with the following line (the page has toi be bound to ViewModelObject of course):

            <material:TabItem Title="{Binding Source={RelativeSource AncestorType={x:Type vm:ViewModelObject}}, Path=PropertyA}">

Thanks for any help

@enisn enisn added bug-report Potential bug that should be verified control-tabview labels Jul 25, 2024
@enisn
Copy link
Owner

enisn commented Jul 25, 2024

Can you provide more information about the exception stacktrace?
Also which platform do yo face this issue?

@enisn
Copy link
Owner

enisn commented Jul 25, 2024

I reproduced the same problem on Windows

   at Microsoft.Maui.Controls.Binding.<ApplyRelativeSourceBinding>d__27.MoveNext()
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext.<>c__DisplayClass2_0.<Post>b__0()

@enisn enisn added bug-verified A bug that can be reproduced and removed bug-report Potential bug that should be verified labels Jul 25, 2024
@JorisZwaenepoel
Copy link

I'm trying to fill in the title of a tabitem using a Binding, but this doesn't work at all.
I do not get this exception. The property getter on the ViewModel is not called.
There is no error in de XAML Binding Failures window.

What would you recommend if I need to change the title in runtime (for translation reasons)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-verified A bug that can be reproduced control-tabview
Projects
None yet
Development

No branches or pull requests

3 participants