How to disable horizontal scrolling of NSScrollView?

KyuubiKyuubi USMember ✭✭

Hi All,

My document view exceeds the horizontal extent of the screen and becomes scrollable. I need to enable or disable horizontal scrolling only when needed. Can anyone navigate me how to proceed with the same?

Thanks.

Best Answer

  • ColeXColeX Xamurai
    edited May 2 Accepted Answer

    Since Forms does not provide this function ,so i'm afraid you have to use custom renderer.

    To disable the horizontal scrolling of NSScrollView , you could set the documentView property ,make the documentView width equals to screen width .

    Something like this

    //disable horizontal scrolling
    var contentView = new NSView(new NSRect(0, 0, screenWidth, Control.DocumentView.Height));
    Control.DocumentView = contentView;
    

Answers

  • ColeXColeX Member, Xamarin Team Xamurai
    edited May 2 Accepted Answer

    Since Forms does not provide this function ,so i'm afraid you have to use custom renderer.

    To disable the horizontal scrolling of NSScrollView , you could set the documentView property ,make the documentView width equals to screen width .

    Something like this

    //disable horizontal scrolling
    var contentView = new NSView(new NSRect(0, 0, screenWidth, Control.DocumentView.Height));
    Control.DocumentView = contentView;
    
  • KyuubiKyuubi USMember ✭✭
    edited May 3

    Hi @ColeX,

    Thanks for the answer. That works great as expected. However I also want to enable the diagonal scrolling which means the view has to be scrolled in 60 degree axis. Currently, I could only able to scroll either in horizontal direction or vertical direction one at a time but not simultaneously. Is it possible to do so?

    Thanks.

Sign In or Register to comment.