Getting Started with .NET MAUI Effects View

This section guides you through setting up and configuring the SfEffectsView in your .NET MAUI application. Follow the steps below to add Effects View to your project.

Prerequisites

Before proceeding, ensure the following are set up:

  1. Install .NET 9 SDK or later.
  2. Set up a .NET MAUI environment with Visual Studio 2022 v17.12 or later.

Step 1: Create a new .NET MAUI project

  1. Go to File > New > Project and choose the .NET MAUI App template.
  2. Name the project and choose a location. Then click Next.
  3. Select the .NET framework version and click Create.

Step 2: Install the Syncfusion® .NET MAUI Toolkit NuGet package

  1. In Solution Explorer, right-click the project and choose Manage NuGet Packages.
  2. Search for Syncfusion.Maui.Toolkit and install the latest version.
  3. Ensure the necessary dependencies are installed correctly, and the project is restored.

Prerequisites

Before proceeding, ensure the following are set up:

  1. Install .NET 9 SDK or later.
  2. Set up a .NET MAUI environment with Visual Studio Code.
  3. Ensure that the .NET MAUI workloads are installed and configured as described here.

Step 1: Create a new .NET MAUI project

  1. Open the command palette by pressing Ctrl+Shift+P and type .NET:New Project and enter.
  2. Choose the .NET MAUI App template.
  3. Select the project location, type the project name and press Enter.
  4. Then choose Create project.

Step 2: Install the Syncfusion® .NET MAUI Toolkit NuGet package

  1. Press Ctrl + ` (backtick) to open the integrated terminal in Visual Studio Code.
  2. Ensure you’re in the project root directory where your .csproj file is located.
  3. Run the command dotnet add package Syncfusion.Maui.Toolkit to install the Syncfusion® .NET MAUI Toolkit NuGet package.
  4. To ensure all dependencies are installed, run dotnet restore.

Prerequisites

Before proceeding, ensure the following are set up:

  1. Install .NET 9 SDK or later.
  2. Set up a .NET MAUI environment with JetBrains Rider 2024.3 or later.
  3. Make sure the MAUI workloads are installed and configured as described here.

Step 1: Create a new .NET MAUI project

  1. Go to File > New Solution, Select .NET (C#) and choose the .NET MAUI App template.
  2. Enter the Project Name, Solution Name, and Location.
  3. Select the .NET framework version and click Create.

Step 2: Install the Syncfusion® MAUI Toolkit NuGet package

  1. In Solution Explorer, right-click the project and choose Manage NuGet Packages.
  2. Search for Syncfusion.Maui.Toolkit and install the latest version.
  3. Ensure the necessary dependencies are installed correctly, and the project is restored. If not, Open the Terminal in Rider and manually run: dotnet restore

Step 3: Register Syncfusion handler

Make sure to add the namespace.

using Syncfusion.Maui.Toolkit.Hosting;

Register the Syncfusion toolkit handler in your CreateMauiApp method of MauiProgram.cs file to use Syncfusion controls.

builder.ConfigureSyncfusionToolkit();

Step 4: Import EffectsView namespace

Add the following namespace in your XAML or C#.

xmlns:effectsView="clr-namespace:Syncfusion.Maui.Toolkit.EffectsView;assembly=Syncfusion.Maui.Toolkit"
using Syncfusion.Maui.Toolkit.EffectsView;

Step 5: Add the EffectsView component

Initialize the SfEffectsView and add the desired UI elements such as an image, label, or any custom view within it to apply visual effects.

<Border HorizontalOptions="Center" VerticalOptions="Center">
    <Border.StrokeShape>
        <RoundRectangle CornerRadius="18" />
    </Border.StrokeShape>
    <Border.Background>
        <LinearGradientBrush EndPoint="1,0">
            <GradientStop Color="#4E54C8" Offset="0.0" />
            <GradientStop Color="#8F94FB" Offset="1.0" />
        </LinearGradientBrush>
    </Border.Background>
    <effectsView:SfEffectsView>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="90" />
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Image Source="laura.png" 
                   Margin="7" 
                   VerticalOptions="Center"
                   WidthRequest="72" 
                   HeightRequest="72" />
                <StackLayout Grid.Column="1" VerticalOptions="Center">
                    <Label Text="Laura Steffi" Margin="10,0,10,0" FontSize="18" />
                    <Label Text="Data Science Analyst" Margin="10,0,10,0" FontSize="12"/>
                </StackLayout>
       </Grid>
        </effectsView:SfEffectsView>
    </Border>
var border = new Border
{
    HorizontalOptions = LayoutOptions.Center,
    VerticalOptions = LayoutOptions.Center,
    StrokeShape = new RoundRectangle
    {
        CornerRadius = 18
    },
    Background = new LinearGradientBrush
    {
        EndPoint = new Point(1, 0),
        GradientStops = new GradientStopCollection
            {
                new GradientStop(Color.FromArgb("#4E54C8"), 0.0f),
                new GradientStop(Color.FromArgb("#8F94FB"), 1.0f)
            }
    }
};

    var grid = new Grid
    {
        ColumnDefinitions =
        {
            new ColumnDefinition { Width = 90 },
            new ColumnDefinition { Width = GridLength.Star }
        }
    };

    var image = new Image
    {
        Source = "laura.png",
        Margin = new Thickness(7),
        VerticalOptions = LayoutOptions.Center,
        WidthRequest = 72,
        HeightRequest = 72
    };

    var nameLabel = new Label
    {
        Text = "Laura Steffi",
        Margin = new Thickness(10, 0),
        FontSize = 18
    };

    var roleLabel = new Label
    {
        Text = "Data Science Analyst",
        Margin = new Thickness(10, 0),
        FontSize = 12
    };

    var stackLayout = new StackLayout
    {
        VerticalOptions = LayoutOptions.Center,
        Children = { nameLabel, roleLabel }
    };

    grid.Add(image);
    grid.Add(stackLayout, 1, 0);

    var effectsView = new SfEffectsView
    {
        Content = grid
    };

    border.Content = effectsView;

    Content = border;

Effects View initialization

You can download the EffectsView Getting Started sample from here.