How to disable an Inspector array

I have an array in a PropertyDrawer custom Inspector. I want to disable the entire array based on a checkbox. If I use this:

public override void OnGUI(Rect position, SerializedProperty property, GUIContent label){
  GUI.enabled = false;

then only the array elements are disabled. I have set isExpanded to false, which is getting close, but how do I gray out the element root?

try this in the your script :

public // array variable