Dynamically bind background isSelected colour

I need to bind background colour of selected panel dynamically. See following code

However “new go.Binding(“background”,“selectedColor”)” seems not working.

A binding cannot return another binding. Do you just want to return the current value of data.selectedColor when the user selects the node? Or something else?

Does this work?

// s should really be boolean and obj a go.GraphObject type
    new go.Binding("background", "isSelected", (s: any, obj: any) => {
      return (s ? obj.part.data.selectedColor : "transparent");

I wrote that by hand, so there might be typos.

Yes, It did the trick.

Thank you!