Exception "Unspecified error" when trying to preset msContentZoomFactor?



    We are trying to use content zooming in a div and encountered an issue. We are trying to pre-set a zoom level at the time it launch an image. We were trying to follow the MSDN document here (http://msdn.microsoft.com/en-us/library/windows/apps/hh453445.aspx) but the app throws an exception when we assign a value to it.

                this.zoomWindowDiv = document.createElement('div');    
                this.zoomWindowDiv.style["overflow"] = "auto";
                this.zoomWindowDiv.style["-ms-content-zooming"] = "zoom";
                this.zoomWindowDiv.style["-ms-scroll-rails"] = "none";
                var zoomScalePctX = zoomWindowContainerWidth / (this.initialFrame.right - this.initialFrame.left) * 100;
                this.zoomWindowDiv.style["-ms-content-zoom-limit-min"] = zoomScalePctX + '%';
                this.zoomWindowDiv.style["-ms-content-zoom-limit-max"] = '100%';
                var scaleX = zoomWindowContainerWidth / (this.initialFrame.right - this.initialFrame.left);
                var retVal = { left: this.initialFrame.left, top: this.initialFrame.top, zoom: scaleX };
                this.zoomWindowDiv.msContentZoomFactor = '0.4';

    It doesn't seem to matter whether we use '0.4' or 0.4.

    We also tried to do it with the style (this.zoomWindowDiv.style.msContentZoomFactor = '0.4';) and it takes no effect. Any thoughts?

    This is the exception thrown:

    Wednesday, October 03, 2012 10:08 PM


  • Microsoft got back to us out of band on this one.  The problem was in trying to set 'msContentZoomFactor' on the div before inserting it into the DOM.  Inserting the element, and then setting the zoom factor worked as expected.
    • Marked as answer by nerff Thursday, October 04, 2012 5:30 PM
    Thursday, October 04, 2012 5:30 PM