Shiblu
Shiblu

Reputation: 477

Xamarin Forms 4.0 Collection View Disable Scrolling

I have Xamarin Forms 4.0 Collection View. I want to disable its scrolling mechanism so that it does not scroll even when the contents. Basically, I want to have a 3x2 / 4x2 grid displayed which does not have any scrolling.

Upvotes: 0

Views: 2613

Answers (2)

sermet
sermet

Reputation: 442

iOS CollectionViewRenderer:

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

      if (Control != null)
      {
          foreach (var view in Control.Subviews)
          {
              if (view is UIScrollView scrollView)
              {
                  scrollView.ScrollEnabled = false;
              }
         }
     }
 }

Android CollectionViewRenderer:

public override bool OnInterceptTouchEvent(MotionEvent ev)
{
     return false;
}

public override bool OnTouchEvent(MotionEvent ev)
{
     return false;
}

Upvotes: 1

user13863410
user13863410

Reputation: 11

If you don't need Selection Mode, you can just activate InputTransparent to true. Maybe that will work !

Upvotes: 1

Related Questions