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 ( {
            case "None":
                return go.GraphObject.None;
            case "Fill":
                return go.GraphObject.Fill;
            case "Uniform":
                return go.GraphObject.Uniform;
            case "UniformToFill":
                return go.GraphObject.UniformToFill;
                return go.GraphObject.Default;
    }).makeTwoWay(/*function (p, o) { return; }*/)


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))

OK that was the magic I was missing.