Interaction in .NET MAUI Effects View
5 Aug 202613 minutes to read
The .NET MAUI Effects View control supports various interactions through its properties. This page documents each trigger and shows how to assign effects to it.
- TouchDownEffects
- LongPressEffects
- TouchUpEffects
Prerequisites
Before using the SfEffectsView, ensure the following NuGet package is installed in your .NET MAUI project:
Syncfusion.Maui.Core
For a step-by-step setup, refer to the Getting Started documentation.
TouchDownEffects
The TouchDownEffects property renders the effect when the user presses the view. Use it for immediate touch feedback.
<syncEffectsView:SfEffectsView x:Name="effectsView"
HorizontalOptions="Center"
VerticalOptions="Center"
TouchDownEffects ="Highlight">
<Grid Padding="12"
WidthRequest="350"
HeightRequest="150"
HorizontalOptions="Center"
VerticalOptions="Center">
<Grid.Background>
<LinearGradientBrush EndPoint="1,1">
<GradientStop Color="#FF6B6B"
Offset="0.0" />
<GradientStop Color="#4ECDC4"
Offset="1.0" />
</LinearGradientBrush>
</Grid.Background>
</Grid>
</syncEffectsView:SfEffectsView>var grid = new Grid
{
Padding = new Thickness(12),
WidthRequest = 350,
HeightRequest = 150,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
Background = new LinearGradientBrush
{
EndPoint = new Point(1, 1),
GradientStops = new GradientStopCollection
{
new GradientStop(Color.FromArgb("#FF6B6B"), 0.0f),
new GradientStop(Color.FromArgb("#4ECDC4"), 1.0f)
}
}
};
var effectsView = new SfEffectsView
{
Content = grid,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
TouchDownEffects = SfEffects.Highlight
};
this.Content = effectsView;LongPressEffects
The LongPressEffects property renders the effect when the user long-presses the view. Use it for context menus or selection gestures.
<syncEffectsView:SfEffectsView x:Name="effectsView"
HorizontalOptions="Center"
VerticalOptions="Center"
LongPressEffects="Scale">
<Grid Padding="12"
WidthRequest="350"
HeightRequest="150"
HorizontalOptions="Center"
VerticalOptions="Center">
<Grid.Background>
<LinearGradientBrush EndPoint="1,1">
<GradientStop Color="#FF6B6B"
Offset="0.0" />
<GradientStop Color="#4ECDC4"
Offset="1.0" />
</LinearGradientBrush>
</Grid.Background>
</Grid>
</syncEffectsView:SfEffectsView>var grid = new Grid
{
Padding = new Thickness(12),
WidthRequest = 350,
HeightRequest = 150,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
Background = new LinearGradientBrush
{
EndPoint = new Point(1, 1),
GradientStops = new GradientStopCollection
{
new GradientStop(Color.FromArgb("#FF6B6B"), 0.0f),
new GradientStop(Color.FromArgb("#4ECDC4"), 1.0f)
}
}
};
var effectsView = new SfEffectsView
{
Content = grid,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
LongPressEffects = SfEffects.Scale
};
this.Content = effectsView;TouchUpEffects
The TouchUpEffects property renders the effect when the user releases the press. Use it to confirm the interaction has completed.
<syncEffectsView:SfEffectsView x:Name="effectsView"
HorizontalOptions="Center"
VerticalOptions="Center"
TouchUpEffects="Selection">
<Grid Padding="12"
WidthRequest="350"
HeightRequest="150"
HorizontalOptions="Center"
VerticalOptions="Center">
<Grid.Background>
<LinearGradientBrush EndPoint="1,1">
<GradientStop Color="#FF6B6B"
Offset="0.0" />
<GradientStop Color="#4ECDC4"
Offset="1.0" />
</LinearGradientBrush>
</Grid.Background>
</Grid>
</syncEffectsView:SfEffectsView>var grid = new Grid
{
Padding = new Thickness(12),
WidthRequest = 350,
HeightRequest = 150,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
Background = new LinearGradientBrush
{
EndPoint = new Point(1, 1),
GradientStops = new GradientStopCollection
{
new GradientStop(Color.FromArgb("#FF6B6B"), 0.0f),
new GradientStop(Color.FromArgb("#4ECDC4"), 1.0f)
}
}
};
var effectsView = new SfEffectsView
{
Content = grid,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
TouchUpEffects = SfEffects.Selection
};
this.Content = effectsView;Combining Multiple Effects on One Interaction
The example below applies both Highlight and Ripple on a single TouchDownEffects trigger.
<syncEffectsView:SfEffectsView x:Name="effectsView"
HorizontalOptions="Center"
VerticalOptions="Center"
TouchDownEffects ="Highlight,Ripple">
<Grid Padding="12"
WidthRequest="350"
HeightRequest="150"
HorizontalOptions="Center"
VerticalOptions="Center">
<Grid.Background>
<LinearGradientBrush EndPoint="1,1">
<GradientStop Color="#FF6B6B"
Offset="0.0" />
<GradientStop Color="#4ECDC4"
Offset="1.0" />
</LinearGradientBrush>
</Grid.Background>
</Grid>
</syncEffectsView:SfEffectsView>var grid = new Grid
{
Padding = new Thickness(12),
WidthRequest = 350,
HeightRequest = 150,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
Background = new LinearGradientBrush
{
EndPoint = new Point(1, 1),
GradientStops = new GradientStopCollection
{
new GradientStop(Color.FromArgb("#FF6B6B"), 0.0f),
new GradientStop(Color.FromArgb("#4ECDC4"), 1.0f)
}
}
};
var effectsView = new SfEffectsView
{
Content = grid,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
TouchDownEffects = SfEffects.Highlight | SfEffects.Ripple
};
this.Content = effectsView;