Help with imageStretch Binding

I am looking for a little help binding the imageStretch property. I am probably complicating things but here is what I have tried:

 new go.Binding("imageStretch","", function (p, o) {
        switch (o.part.data.imageStretch) {
            case "None":
                return go.GraphObject.None;
                break;
            case "Fill":
                return go.GraphObject.Fill;
                break;
            case "Uniform":
                return go.GraphObject.Uniform;
                break;
            case "UniformToFill":
                return go.GraphObject.UniformToFill;
                break;
            
            default:
                return go.GraphObject.Default;
        }
    }).makeTwoWay(/*function (p, o) { return p.name; }*/)

Thanks

First, I should mention that you really shouldn’t use bindings to the whole object unless you really need to. By that I mean using the empty string as the source property name, the second argument to a Binding constructor. In this case you really don’t need to.

Second, use Binding.parseEnum and Binding.toString to convert string names into EnumValues and vice-versa.

So your binding should be:

  new go.Binding("imageStretch", "imageStretch",
                 go.Binding.parseEnum(go.GraphObject, go.GraphObject.Fill))
      .makeTwoWay(go.Binding.toString)

OK that was the magic I was missing.