Events in Xamarin Effects View (SfEffectsView)
13 May 20212 minutes to read
AnimationCompleted event
The AnimationCompleted
event occurs when the rendered effects have been completed.
<syncEffectsView:SfEffectsView
TouchDownEffects="Ripple"
AnimationCompleted="AnimationCompleted">
...
</syncEffectsView:SfEffectsView>
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
var effectsView = new SfEffectsView
{
TouchDownEffects = SfEffects.Ripple
};
effectsView.AnimationCompleted += AnimationCompleted;
...
}
private void AnimationCompleted(object sender, EventArgs e)
{
...
}
}
NOTE
When the effects are rendered on direct interaction, the
AnimationCompleted
event occurs on touch up, and when it is applied programmatically, it is triggered immediately on completion of effects.
NOTE
The
AnimationCompleted
event is not applicable forSfEffects.Selection
.
SelectionChanged event
The SelectionChanged
event occurs when SfEffectsView
is selected or unselected.
<syncEffectsView:SfEffectsView
LongPressEffects="Selection"
SelectionChanged="SelectionChanged"
TouchDownEffects="None"
TouchUpEffects="None">
...
</syncEffectsView:SfEffectsView>
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
var effectsView = new SfEffectsView
{
LongPressEffects = SfEffects.Selection,
TouchDownEffects = SfEffects.None,
TouchUpEffects = SfEffects.None
};
effectsView.SelectionChanged += SelectionChanged;
...
}
private void SelectionChanged(object sender, EventArgs e)
{
...
}
}
NOTE
The
SelectionChanged
event triggers both on renderingSfEffects.Selection
by direct interaction and on changing theIsSelected
property ofSfEffectsView
.