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]

System.Object
  System.Attribute
    System.Windows.Media.DisableDpiAwarenessAttribute

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
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft