Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

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)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple=false)] 
public sealed class DisableDpiAwarenessAttribute : Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple=false) */ 
public final class DisableDpiAwarenessAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple=false) 
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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.