-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] add Element and Element Property Changed hooks for ImageButton #4495
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make the virtual method empty. think about your future children
ImageButton?.SendViewInitialized(Control); | ||
} | ||
|
||
protected virtual void OnElementChanged(ElementChangedEventArgs<ImageButton> e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to keep the virtual void OnElementChanged
empty and invokes it after firing the event
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mainly did it like this because this is how VisualElementRenderer does it
https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.Android/VisualElementRenderer.cs#L305
So I just copied that one for the sake of consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it's possible for someone to want to control when (or whether) to invoke ElementChanged when they override OnElementChanged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record I do agree with @StephaneDelcroix
But I did it this way because this is the same way we do it literally everywhere that I could find. So I feel like at this point consistency should be the winner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, agreed. Consistency is best. :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, agreed. Consistency is best. :/
disagreed, but I'm not going to die on this hill
Description of Change
ImageButton Renderer for Android didn't provide overrides that are consistent with other renderers for hooking into element and element property change events
API Changes
Added the following methods to the ImageButtonRenderer
Platforms Affected
Testing Procedure
Add a custom ImageButtonRenderer for Android
PR Checklist