V-Vek P-Tel
V-Vek P-Tel

Reputation: 77

Hide Scollbar of ScrollView for Xamarin MAC platform

I want to hide the scollbar of ScollView in Xamarin.Forms I made rendere in UWP and it is working perfect and the code is

 protected override void OnElementChanged(ElementChangedEventArgs<ScrollView> e)
    {
        try
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                ScrollView el = (ScrollView)this.Element;

                Control.HorizontalScrollBarVisibility = Windows.UI.Xaml.Controls.ScrollBarVisibility.Hidden;
                //Control.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
            }
        }
        catch (Exception ex)
        {
        }           
    }

But can not able to find the OnElementChanged event for MAC platform

So kindly guide me how to hide scollbar of ScollView for MAC

A single guidance can lead to me a solution. Thanks is advance

Upvotes: 0

Views: 112

Answers (1)

SushiHangover
SushiHangover

Reputation: 74094

NSScrollView: https://developer.apple.com/documentation/uikit/uiscrollview?language=objc

scrollView.HasVerticalScroller = false;
scrollView.HasHorizontalScroller = false;

Note: One of the issues within Cocoa/AppKit and mixing any CoreAnimation the scroll bars tend to flash... This has been radr'd for a long time so I doubt Apple will fix it as the future will be a UIKit "replacement". So if you are not animating the NSScrollView within its owning container, you should not have any problem, otherwise creating a custom NSView control might be the only way to go (that is what I have done). And thus Xamarin.Forms 4.0 does suffers from this issue.

Upvotes: 2

Related Questions