Comments (6)
Thank you very much for the quick response and the change.
Exactly what i needed and working like a charm!
from mvvmblazor.
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()
?
from mvvmblazor.
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?
from mvvmblazor.
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.
from mvvmblazor.
This could only be achieved by having a binding on a type that implements INotifyPropertyChanged
and then listen to changed events on this end. Would be a new feature and possibly be a bit tedious to implement because it would break with current behavior. Would that suit you?
from mvvmblazor.
Ah I think i did not get that across correctly.
I do not want the Model to notify on the ViewModel. The ViewModel would still invoke the notification itself but the changes should be reflected on the Model so that the Business logic can handle the requests.
So I want the Model to hold the state for the api client and the ViewModel for interaction with the component.
I updated my code example a little so maybe it gets clearer.
In the end I think I can do with what I have shown in the example if there is not a build in way to deal with it.
Would it still be possible to add [CallerMemberName]
to the OnPropertyChanged()
Method?
from mvvmblazor.
Related Issues (20)
- Cannot use Blazored ILocalStorageService inside ViewModel HOT 2
- Blazor Server - No Startup HOT 5
- MvvmDialogs HOT 1
- Scope management enhancement HOT 7
- MvvmComponentBase does not call AsyncServiceScope.DisposeAsync() HOT 1
- Allow custom EqualityComparer on ViewModelBase.Set<T>() function HOT 1
- Parameters with non-public accessors are not set HOT 9
- Switch to CommunityToolkit.Mvvm HOT 2
- Layouts? HOT 11
- Remove constructor for generated components HOT 2
- Razor page dispose not firing when inheriting from view model HOT 4
- Why is the lifetime of scoped view models tied to the component lifetime instead of the request lifetime? HOT 2
- How can an MvvmComponent implement IAsyncDisposable? HOT 4
- Index out of bound exception
- Feature request: "MvvmOwningComponentBase" which inherit from OwningComponentBase HOT 1
- Update Service Locator Pattern in MVVMComponentBase to Constructor Injection HOT 1
- Can the CodeGenerators be bundled with the nuget package? HOT 5
- Is there a way to InvokeAsync within the view model? HOT 9
- After upgrade to version 6.0.3 scoped dependency injection is not working properly HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mvvmblazor.