You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by michaelcsikos May 23, 2022
I have two collections, one inherits from BusinessListBase, and the other from BusinessBindingListBase. Each collection is wrapped in a ViewModel<T>. The PropertyChangedEventHandler from the root edit page is passed down to all the children:
// Root edit pageprivateasyncvoidPropertyChanged(object?sender,PropertyChangedEventArgse){await InvokeAsync(()=> StateHasChanged());}// In each child collection[Parameter]public PropertyChangedEventHandler PropertyChanged {get;set;}protectedoverridevoidOnInitialized(){
VM.ModelPropertyChanged +=PropertyChanged;}
In the collection ViewModel, child items are deleted like this:
publicvoidRemove(WidgetVMcontext){if(Model==null)return;
Model .Remove(context.Model);
WidgetVMs.Remove(context);}
For the BusinessListBase deleting a child item triggers PropertyChanged, it bubbles up to the root edit page and the Save button becomes enabled, but it's not bubbling up for the BusinessBindingListBase. Ordinarily I would just use BusinessListBase to solve it, but we have some classes which are used in WinForms as well.
Am I approaching this correctly, i.e. making a VM to wrap each collection, and a VM to wrap each child item, and passing PropertyChangedEventHandler down?
The text was updated successfully, but these errors were encountered:
Discussed in #2951
Originally posted by michaelcsikos May 23, 2022
I have two collections, one inherits from
BusinessListBase
, and the other fromBusinessBindingListBase
. Each collection is wrapped in aViewModel<T>
. ThePropertyChangedEventHandler
from the root edit page is passed down to all the children:In the collection
ViewModel
, child items are deleted like this:For the
BusinessListBase
deleting a child item triggersPropertyChanged
, it bubbles up to the root edit page and the Save button becomes enabled, but it's not bubbling up for theBusinessBindingListBase
. Ordinarily I would just useBusinessListBase
to solve it, but we have some classes which are used in WinForms as well.Am I approaching this correctly, i.e. making a VM to wrap each collection, and a VM to wrap each child item, and passing
PropertyChangedEventHandler
down?The text was updated successfully, but these errors were encountered: