Partager via


Settings.EnableAutoZoom Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that indicates whether the Silverlight plug-in will resize its content based on the current browser zoom setting.

Namespace:  System.Windows.Interop
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property EnableAutoZoom As Boolean
public bool EnableAutoZoom { get; set; }

Property Value

Type: System.Boolean
true if Silverlight responds to the browser zoom setting; otherwise, false. The default is true if there is no handler for the Zoomed event; otherwise, the default is false.

Remarks

Some browsers provide a way for users to zoom the displayed content to make it larger or smaller. By default, Silverlight content automatically resizes in response to changes in the browser zoom setting. You can disable this feature by setting Settings.EnableAutoZoom to false, or replace it by handling the Zoomed event. If you want to supplement the zooming feature instead of replacing it, handle the Zoomed event and set EnableAutoZoom to true.

You can set this property at runtime or in the HTML object element through the plug-in EnableAutoZoom (Silverlight Plug-in Object) property.

You can access the zoom setting for the current browser window through the ZoomFactor property.

NoteNote:

The browser zoom setting can affect any code that depends on precise sizing or placement of the plug-in within the host Web page. Different browsers respond to zoom settings in different ways. The operating system dots per inch (DPI) display setting can also affect the zoom setting. If your application uses custom sizing logic, be sure to test it on different browsers and with high DPI settings.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.