Scales a single child element to fill the available space without resizing it. This control reacts to changes in the size of the container as well as changes in size of the child element. For example, a media query may result in a change in aspect ratio.
If you add more than one element to a ViewBox, only the first element is resized. If you must scale more than one element, wrap the set of elements in a DIV. See the example below for more information. Elements that do not scale, such as text, are not affected by the transforms used for the ViewBox.
The ViewBox object has these types of members:
The ViewBox object has these constructors.
Initializes a new instance of the ViewBox control.
The ViewBox object has these methods.
Adds an event handler for the specified event.
Releases resources held by this ViewBox. Call this method when the ViewBox is no longer needed. After calling this method, the ViewBox becomes unusable.
Forces the ViewBox to update its layout. Use this function when making the ViewBox visible again after its style.display property had been set to "none".
Removes an event handler that the addEventListener method registered.
The ViewBox object has these properties.
Gets the DOM element that functions as the scaling box.
To customize a ViewBox, you can define your own styles for these CSS classes (defined by the WinJS style sheets):
Styles the entire ViewBox control.
The following HTML shows how to display multiple elements inside a ViewBox:
<div data-win-control="WinJS.UI.ViewBox"> <div id="containerDiv"> <div id="div1"> <div id="div2"> <div id="div3"> </div> </div>
Minimum WinJS version