Skip to content

Bind to support viewmodel with property within a model #203

Closed Answered by brminnick
GirusVirus asked this question in Q&A
Discussion options

You must be logged in to vote

You're doing a Nested Binding which requires a bit more configuration. This is because your ObservableProperty is the Sales property in the ViewModel, however you want the value of its CoreSales Property nested inside Sales.CoreSales. And .NET MAUI's binding engine needs to know about every property + nested property along the way.

👇 Here's a few ways how you can solve your problem

1. Create a Nested Binding

This is technically the correct way to do nested bindings. However, it is also the most complex way to create a binding.

Here's how to configure .Bind() to bind to CoreSales while telling .NET MAUI binding engine to monitor it along with its parent class Sales.

.Bind(Label.TextProperty,

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@brminnick
Comment options

Comment options

You must be logged in to vote
1 reply
@GirusVirus
Comment options

Answer selected by brminnick
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants