Skip to content

Default Events

eiadxp edited this page Apr 10, 2019 · 1 revision

In WPF, all controls has a default event defined by using DefaultEvent attribute at class level. For example the Button control has Click event defined as default event in its signature like this:

[DefaultEvent("Click")]
public class Button : ButtonBase
{
}

However, Xamarin controls does not define default controls, so we used methods in Configurations.Reflaction static class to define these events:

Control Default Event
Button Clicked
WebView Navigated
SearchBar SearchButtonPressed
Slider ValueChanged
Stepper ValueChanged
Switch Toggled
DatePicker DateSelected
TimePicker PropertyChanged
Entry Completed
Editor Completed
ListView ItemSelected
Picker SelectedIndexChanged

This happen the first time you create an EventBindingsCollection.

If you want to add or change this behavior use the static method Configurations.Reflaction.SetDefaultEvent.

Clone this wiki locally