Introducing the New .NET MAUI Carousel Control
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (179).NET Core  (29).NET MAUI  (214)Angular  (110)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (225)BoldSign  (15)DocIO  (24)Essential JS 2  (109)Essential Studio  (200)File Formats  (68)Flutter  (133)JavaScript  (226)Microsoft  (120)PDF  (81)Python  (1)React  (105)Streamlit  (1)Succinctly series  (131)Syncfusion  (938)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (52)Windows Forms  (61)WinUI  (71)WPF  (162)Xamarin  (161)XlsIO  (38)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (9)Business intelligence  (55)Button  (4)C#  (157)Chart  (139)Chart of the week  (53)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (68)Development  (654)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (14)Excel  (43)Extensions  (22)File Manager  (7)Gantt  (19)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (512)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (54)Security  (4)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (14)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (393)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (611)What's new  (333)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Introducing the New .NET MAUI Carousel Control

Introducing the New .NET MAUI Carousel Control

We are happy to introduce the new Syncfusion .NET MAUI Carousel control in our latest release, Essential Studio 2023 Volume 4. This control is an intuitive interface for navigating through a collection of views with and without scaling and rotation transformations.

In this blog, we’ll explore the key features of the .NET MAUI Carousel control and the steps to get started with it!

Key features

The key features of the new .NET MAUI Carousel are:

Items arrangement

In .NET MAUI Carousel control, you can display items in 3D or linear arrangements with swipe gestures.

.NET MAUI Carousel Control with Different Visual Modes
.NET MAUI Carousel control with different visual modes

On-demand loading

On-demand loading enables users to load a subset of data in the current viewport and load more items when needed. This helps users increase initial loading performance when populating large items.

On-demand Loading in .NET MAUI Carousel Control
On-demand loading in .NET MAUI Carousel control

Customization

The Carousel control allows you to customize the offset, scaling, rotation angle, and duration. Let’s see them in brief.

Offset customization

By applying the desired offset value, you can customize the space between unselected items in the .NET MAUI Carousel control.

Customizing the Offset in .NET MAUI Carousel Control
Customizing the offset position in .NET MAUI Carousel control

Scaling customization

You can customize the scaling of unselected items in the .NET MAUI Carousel control by applying the desired scaling value.

Scaling Customization in .NET MAUI Carousel Control
Scaling customization in .NET MAUI Carousel control

Rotation angle customization

By applying the desired angle value, you can customize the rotation angle of unselected items in the .NET MAUI Carousel control.

Customizing the Rotation Angle in .NET MAUI Carousel Control
Customizing the rotation angle in .NET MAUI Carousel control

Duration customization

You can customize the time for item transitions by applying the desired duration value

Customizing Animation Duration in .NET MAUI Carousel Control
Customizing animation duration in .NET MAUI Carousel control

Note: For more details, refer to the .NET MAUI Carousel control documentation.

Getting started with the .NET MAUI Carousel control

We have seen the key features of the .NET MAUI Carousel control. Let’s learn how to integrate it into your .NET MAUI app and utilize its features by following these steps:

Step 1: Create a .NET MAUI application.

Step 2: The Syncfusion .NET MAUI controls are available on NuGet Gallery. To add the .NET MAUI Carousel control to your project, open the NuGet package manager in Visual Studio. Search for Syncfusion.Maui.Carousel and install it.

Step 3: Now, register the handler for the Syncfusion core in the MauiProgram.cs file.

using Microsoft.Maui;
using Microsoft.Maui.Hosting;
using Microsoft.Maui.Controls.Compatibility;
using Microsoft.Maui.Controls.Hosting;
using Microsoft.Maui.Controls.Xaml;
using Syncfusion.Maui.Core.Hosting;
namespace CarouselSample
{
    public static class MauiProgram
    {
        public static MauiApp CreateMauiApp()
        {
            var builder = MauiApp.CreateBuilder();
            builder
                .UseMauiApp()
                .ConfigureSyncfusionCore()
                .ConfigureFonts(fonts =>
                {
                    fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                });
            return builder.Build();
        }
    }
}

Step 4: Add the Syncfusion.Maui.Carousel namespace in your XAML page.

xmlns:buttons="clr-namespace:Syncfusion.Maui.Carousel;assembly=Syncfusion.Maui.Carousel"

Step 5: Create a model view to hold the image data. Refer to the following code example.

public class CarouselModel
{
    public CarouselModel(string imageString)
    {
        Image = imageString;
    }
    private string _image;
    public string Image
    {
        get { return _image; }
        set { _image = value; }
    }
}

Step 6: Populate the carousel items collection in the View model with the image data.

public class CarouselViewModel
{
    public CarouselViewModel()
    {
        ImageCollection.Add(new CarouselModel("carousel_touriestplace1.png"));
        ImageCollection.Add(new CarouselModel("carousel_touriestplace2.png"));
        ImageCollection.Add(new CarouselModel("carousel_touriestplace3.png"));
        ImageCollection.Add(new CarouselModel("carousel_touriestplace4.png"));
        ImageCollection.Add(new CarouselModel("carousel_touriestplace5.png"));
    }
    private List imageCollection = new List();
    public List ImageCollection
    {
        get { return imageCollection; }
        set { imageCollection = value; }
    }
}

Step 7: Finally, initialize the Syncfusion .NET MAUI Carousel control. Populate the items in the default view mode. Refer to the following code example.

<ContentPage.BindingContext>
 <local:CarouselViewModel/>
</ContentPage.BindingContext>

<ContentPage.Resources>
 <ResourceDictionary>
  <DataTemplate x:Key="itemTemplate">
   <Image Source="{Binding Image}" Aspect="AspectFit"/>
  </DataTemplate>
 </ResourceDictionary>
</ContentPage.Resources>

<ContentPage.Content>
 <carousel:SfCarousel x:Name="carousel"  
                      ItemTemplate="{StaticResource itemTemplate}"
                      ItemsSource="{Binding ImageCollection}" 
                      HeightRequest="400" 
                      WidthRequest="800"/>
</ContentPage.Content>

After executing the previous code example, you’ll see output like the following image.

Integrating Carousel Control into a .NET MAUI App
Integrating Carousel control into a .NET MAUI app

GitHub reference

You’ll find the complete getting started example for .NET MAUI Carousel control on GitHub.

Conclusion

Thanks for reading! In this blog, we’ve seen the features of the new .NET MAUI Carousel control introduced in the 2023 Volume 4 release. Check out our Release Notes and What’s New pages to see the other updates in this release, and leave your feedback in the comments section.

For current Syncfusion customers, the newest version of Essential Studio is available from the license and downloads page. If you are not yet a customer, you can try our 30-day free trial to check out these new features.

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

Related blogs

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed