[MacOS] make OnElementChanged and OnElementPropertyChanged protected virtual#1187
[MacOS] make OnElementChanged and OnElementPropertyChanged protected virtual#1187StephaneDelcroix merged 2 commits intoxamarin:masterfrom MichaelRumpler:master
Conversation
…like all other renderers
StephaneDelcroix
left a comment
There was a problem hiding this comment.
fine for me, minus the comment
| } | ||
|
|
||
| void OnElementChanged(VisualElementChangedEventArgs e) | ||
| protected virtual void OnElementChanged(VisualElementChangedEventArgs e) |
There was a problem hiding this comment.
we try to not trigger events from virtual methods.
|
Good call, but you do raise ElementChanged yourself from CarouselPageRenderer.OnElementChanged, MasterDetailPageRenderer.OnElementChanged, NavigationPageRenderer.OnElementChanged, TabbedPageRenderer.OnElementChanged and even VisualElementRenderer.OnElementChanged. I changed all the *PageRenderers and ScrollViewRenderer now. The event is now raised in the private Raise(or Handle-)ElementChanged method and the virtual OnElementChanged method is just an empty template method. Thus the ElementChanged event is still raised even if a derived class does not call base.OnElementChanged. I did not change the VisualElementRenderer as this is used everywhere (also shared with iOS). |
and on BindableObject.PropertyChanged too... and you can't start to imagine how we regret it |
…virtual (#1187) * make OnElementChanged and OnElementPropertyChanged protected virtual like all other renderers * raise ElementChanged outside virtual OnElementChanged method
Description of Change
In Xamarin.Forms.Platform.MacOS the PageRenderer and ScrollViewRenderer did not have the usual protected virtual methods OnElementChanged and OnElementPropertyChanged. They were private and partly wrong named. Therefore users could not inherit from those renderers and use them as every other renderer on every other platform.
API Changes
Changed:
Behavioral Changes
None
PR Checklist