Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DisableDpiAwarenessAttribute Class

Allows WPF applications to disable dots per inch (dpi) awareness for all user interface elements.

Namespace:  System.Windows.Media
Assembly:  WindowsBase (in WindowsBase.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public final class DisableDpiAwarenessAttribute extends Attribute
<DisableDpiAwarenessAttribute .../>

By default, WPF applications are dpi aware, which affects how user interface layout is calculated. However, an application can disable dpi awareness by adding the DisableDpiAwarenessAttribute to the application assembly.

Caution noteCaution:

It is not recommended that you set this attribute for your application, unless you need all user interface elements of your application to be non-dpi aware.

The following example shows how to disable Dpi awareness for the WPF application by declaring DisableDpiAwarenessAttribute at the assembly level.

// Disable Dpi awareness in the application assembly.
[assembly: System.Windows.Media.DisableDpiAwareness]


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0

Community Additions

© 2015 Microsoft