-
Notifications
You must be signed in to change notification settings - Fork 49
Guidance on Two-Way Binding on a Model property #100
Comments
To elaborate, i was looking for something less verbose than: public string Name
{
get => _model.Name;
set
{
_model.Name = value;
OnPropertyChanged(nameof(Name));
}
} On top of that, could the [CallerMemberName] attribute also be added to OnPropertyChanged Method, so i can at least just write OnPropertyChanged() ? |
Currently there is no built-in solution for this. Could you elaborate why you want a binding on a sub model? Is the model changed externally outside of the view model? |
The Model is part of my Business Logic that communicates with a REST Api. The ViewModel should enable modifying the Model and then sending a request back to the Api without having to map in between the models. |
This could only be achieved by having a binding on a type that implements |
Ah I think i did not get that across correctly. So I want the Model to hold the state for the api client and the ViewModel for interaction with the component. Would it still be possible to add |
Thank you very much for the quick response and the change. |
Question
Hello,
I am just starting out with blazor and your Mvvm library is already helping me a lot getting on.
I just have a question if you could explain how to best handle two-way bindings on properties that are bound from the model.
For example i have a model and a viewmodel like below.
How would i go best to integrate notification into that view model?
Cheers
Simon
Code sample
Version
6.0.3
Are you using Blazor WASM or Blazor Server?
Balzor Server
The text was updated successfully, but these errors were encountered: