how to remove or hide indicator carouselview MAUI app

Nam Pham 116 Reputation points
2023-03-15T08:57:13.9733333+00:00

Screenshot 2023-03-15 155529

how can i remove or hide this?

it appears when i swipe carousel.

it happens on iOS

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,231 questions
0 comments No comments
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 29,381 Reputation points Microsoft Vendor
    2023-03-16T08:07:10.1433333+00:00

    Hello,

    The CarouselView is rendered by UICollectionView in iOS platform, and UICollectionView is derived from UIScrollView. You can set showsHorizontalScrollIndicator and showsVerticalScrollIndicator false to hide the indicator.
    With MAUI, you could custom control with handlers and overwrite the ScrollToRequested method, please refer to .NET MAUI control customization with handlers - .NET MAUI | Microsoft Learn and the following code:

    CustomCarouseHandler.cs

    namespace CarouselViewDemos.Handler
    {
        public partial class CustomCarouseHandler: Microsoft.Maui.Controls.Handlers.Items.CarouselViewHandler
        {
           
        }
    }
    

    CustomCarouseHandler.ios.cs

    namespace CarouselViewDemos.Handler
    {
        public partial class CustomCarouseHandler
        {
            protected override void ScrollToRequested(object sender, ScrollToRequestEventArgs args)
            {
                Controller.CollectionView.ShowsHorizontalScrollIndicator = false;
                Controller.CollectionView.ShowsVerticalScrollIndicator = false;
                base.ScrollToRequested(sender, args);
            }
        }
    }
    

    Register the handler using the ConfigureMauiHandlers and AddHandler methods in your app's MauiProgram class.

     builder
    .UseMauiApp<App>()
    .ConfigureFonts...
    .ConfigureMauiHandlers(handlers =>
                      {
                            handlers.AddHandler(typeof(CarouselView), typeof(CustomCarouseHandler));
    
                      });
    
    

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful