OnPropertyChange event access from the ViewModel #2661
Unanswered
kcabral817
asked this question in
Questions
Replies: 3 comments 6 replies
-
Which ViewModel? Xaml, Blazor, etc? |
Beta Was this translation helpful? Give feedback.
0 replies
-
xaml wpf |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm assuming CSLA 5. There is an In this override you can hook and unhook the events of the Model (business domain object), including PropertyChanged. This is from memory, so might not be quite right, but something like this: protected override void OnModelChanged(T oldValue, T newValue)
{
if (oldValue is INotifyPropertyChanged npc)
npc.PropertyChanged -= ModelPropertyChanged;
if (newValue is INotifyPropertyChanged npc)
npc.PropertyChanged += ModelPropertyChanged;
}
private void ModelPropertyChanged(object s, PropertyChangedEventArgs e)
{
// handle the event here
} |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How do I get the event in the ViewModel that a field was changed in the BO? I have a collection in the businessBase class that I need to consume and redirect to the message window of the view model. But I am unable to figure out how to monitor the OnPropertyChange event from the view model.
Beta Was this translation helpful? Give feedback.
All reactions