How can I get ScrollRect's state(scrolling or not scrolling) ?

Hi, I want get scrollrect’s state (Is scrolling or not scrolling). I try OnScroll event but it is not working.

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class Scroll : MonoBehaviour, IScrollHandler
{
    public Canvas c;
    public void OnScroll(PointerEventData eventData)
    {
        c.pixelPerfect = false;
    }   
}

I try also OnBeginDrag and OnEndDrag events. This worked but unfortunately did not worked for scrollrect’s inertia, when I mouse button up.

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class Scroll : MonoBehaviour, IBeginDragHandler, IEndDragHandler
{
    public Canvas c;
    public void OnBeginDrag(PointerEventData eventData)
    {        
        c.pixelPerfect = false;
    }
    public void OnEndDrag(PointerEventData eventData)
    {        
        c.pixelPerfect = true;
    }
}

You can try something like this:

    public Canvas c;
    public ScrollRect scroller;

    void Awake()
    {
        scroller.onValueChanged.AddListener(DisablePixelPerfect);
    }

    void DisablePixelPerfect(Vector2 vector)
    {
        if (scroller.velocity.x != 0 || scroller.velocity.y != 0) // so Scroll is moving
        {
            c.pixelPerfect = false;
        }
        else
        {
            c.pixelPerfect = true;
        }
    }

Remember that “onValueChanged” is invoked on every value changed I mean, a lot. So to optimize just put there boolean to disable pixelperfect only if it’s enabled and enable pixel when it’s disabled.

how can I implement the functionality of shop system like in clash of clans into unity project