Disable all the buttons if diagram is read only

I want to Disable all the button in diagram when diagram is in readonly mode.

I tried with some binding like this:
new go.Binding(‘isEnabled’, ‘btnIsEnabled’, function () {
if (_that.diagram.isReadOnly === true) {
return false;
return true;

There’s no data binding of Diagram properties. But you can data bind on the shared Model.modelData object’s properties. Example:

<input id="myCheckBoxRO" type="checkbox" onclick="toggleRO()">isReadOnly</input>
function toggleRO() {
  myDiagram.commit(d => {
    d.isReadOnly = document.getElementById("myCheckBoxRO").checked;
    d.model.set(d.model.modelData, "isReadOnly", d.isReadOnly);

This binds the Panel.isEnabled property to the data.isReadOnly property of the Model.modelData shared object.

myDiagram.nodeTemplate =
    . . .,
      { . . .,
        click: (e, button) => alert("clicked")
      new go.Binding("isEnabled", "isReadOnly", b => !b).ofModel(),
      . . .)

Thanks a lot Walter!