Copied RSS Feed

.NET MAUI

Add Effects Like a Pro Using .NET MAUI Effects View

Adding effects to an application (particularly in a mobile app) is an important part of building your app. Adding effects not only enhances the app’s appearance but also user interaction and experience.

Especially, when you are developing a cross-platform app like in .NET MAUI, you should apply good effects to your UI design. In this blog, I’ll show you how to use our Effects View control to do this.

Basic .NET MAUI Effects

Mobile apps like .NET MAUI commonly include basic effects, like ripple, rotation, and scaling. These kinds of animations make the app highly interactive.

.NET MAUI Effects View

At Syncfusion, we understand the need for and usage of this requirement and provide you with a control named .NET MAUI Effects View. It’s a container control that provides modern effects like ripple, selection, scaling, and rotation. You can render these effects using touch interactions, such as touch down, touch up, and long press, and also by calling the API.

You can easily integrate the control into your .NET MAUI app and it will take care of the effects based on your requirement and settings.

How to integrate .NET MAUI Effects View in your app

Syncfusion .NET MAUI controls are available on Nuget.org. To add the Effects View control to your project, first, open the NuGet package manager in Visual Studio. Search for Syncfusion.Maui.Core and then install it. Then, follow these steps:

Step 1: In the MauiProgram.cs file, register the handler for Syncfusion core.

public static class MauiProgram
{
  public static MauiApp CreateMauiApp()
  {
    var builder = MauiApp.CreateBuilder();
    builder.ConfigureSyncfusionCore();
    return builder.Build();
  }
 
}

Step 2: Then, add the Syncfusion.Maui.Core namespace using the following code.

xmlns:effectsView="clr-namespace:Syncfusion.Maui.Core;assembly=Syncfusion.Maui.Core"

Step 3: Finally, add the Syncfusion .NET MAUI Effects View as the parent of the element to which you need to add the effects. Here, I have added it to a card UI.

<effectsView:SfEffectsView>
 <Grid WidthRequest="200" HeightRequest="75" ColumnDefinitions="75,*">
  <Image Source="Person.png"/>
   <VerticalStackLayout Grid.Column="1">
    <Label Text="Laura Steffi" FontSize="18"/>
    <Label Text="Data Science Analyst" />
   </VerticalStackLayout>
 </Grid>
</effectsView:SfEffectsView>
Adding .NET MAUI Effects View to Card UI

Effects

Now, let’s see the various effects supported by the .NET MAUI Effects View control.

Highlight effects

SfEffects.Highlight is a smooth transition on the background color of the Effects View control.

<effectsView:SfEffectsView TouchDownEffects="Highlight"  HighlightBackground="#FF0000"/
Highlight Effects in .NET MAUI Effects View Control

Ripple

The SfEffects.Ripple is an expandable circle. It is initially placed on the tapped location, and it grows till the whole layout is filled. The SfEffects.Ripple is rendered based on the InitialRippleFactor.

<effectsView:SfEffectsView TouchDownEffects="Ripple"/>
Ripple Effects in .NET MAUI Effects View Control

Rotation

SfEffects.Rotation provides a circular movement to the Effects View control around the center based on the specified Angle.

<effectsView:SfEffectsView TouchDownEffects="Rotation"  Angle="180"/>
Rotation Effects in .NET MAUI Effects View Control

Scale

SfEffects.Scale is a smooth transition on the size of the SfEffectsView.Content from its actual size to the size mentioned on the ScaleFactor in pixels.

<effectsView:SfEffectsView ScaleFactor="0.85" TouchDownEffects="None" TouchUpEffects="None" LongPressEffects="Scale"/>
Scale Effects in .NET MAUI Effects View Control

Selection

SfEffects.Selection is a smooth color transition to indicate whether the Effects View state is selected or not.

<effectsView:SfEffectsView  LongPressEffects="Selection" SelectionBackground="#FF0000"/>
Selection Effects in .NET MAUI Effects View Control

Valid combination of effects

Following are the valid combination of effects that can be applied in the .NET MAUI Effects View control:

  • Highlight and ripple
  • Highlight and selection
  • Ripple and selection
  • Highlight, ripple, and selection
  • Scale and selection

Possible interactions to show effects

Now, let’s see the different touch interaction features available to set effects in the .NET MAUI Effects View control.

Touch down

Use the TouchDownEffects property to render the effects with touch-down interaction.

<effectsView:SfEffectsView TouchDownEffects="Ripple"/>

Long press

Use the LongPressEffects property to render the effects with long-press interaction.

<effectsView:SfEffectsView LongPressEffects="Ripple"/>

Touch up

Use the TouchUpEffects property to render the effects with touch-up interaction.

<effectsView:SfEffectsView TouchUpEffects="Ripple"/>

When and where effects are needed

Effects are needed on interactive elements like buttons, sliders, tab headers, switches, etc. These interactive elements generally show ripple effects on tapping and highlight effects on mouse hovering. Cross-platform apps like .NET MAUI will depend on mouse hover and tap interactions.

If you are creating an interactive Image control, then simply add those interactions into the .NET MAUI Effects View control. Don’t worry, the control will take care of the effects.

Note: For more details, refer to the Getting started with .NET MAUI Effects View documentation.

Conclusion

Thanks for reading! I hope you enjoyed this blog. Try out the modern effects available in our .NET MAUI Effects View control and leave your feedback in the comments section below!

For questions, you can contact us through our support forumsupport portal, or feedback portal. As always, we are happy to assist you!

Related blogs

Meet the Author

Selva Ganapathy Kathiresan

Selva Ganapathy Kathiresan is an Assistant General Manager at Syncfusion and a Microsoft MVP (2014), who sees through the development of Mobile and Desktop components. His areas of expertise are React, .NET MAUI, Xamarin, WPF, UWP and other .NET Frameworks.