Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8986117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:28:31+00:00 2026-06-15T21:28:31+00:00

Good day! I’ve been working on a WPF app for some time now (as

  • 0

Good day!

I’ve been working on a WPF app for some time now (as a learning experience and oh boy it was a learning experience) and it’s finally ready for release. Release means installing it on my HTPC where it will be used to browse my movie collection.

I designed it on my PC which runs 1920*1080 but at the normal DPI setting, while the HTPC/TV is running at the same resolution but a higher DPI setting for obvious reasons.

The problem is my app goes bonkers on the HTPC, messing up pretty much everything as far as visuals go. I know this is due to bad design (mea culpa), but since it’s an application that will only be used by me I’m looking for an quick fix, not a full redesign. I read it would be possible to stop the app from being DPI aware by adding the following to AssemblyInfo.cs:

[assembly: System.Windows.Media.DisableDpiAwareness]

However, it doesn’t seem to have any effect and the behavior of the app remains the same.

Could anyone point me in the right direction?

Thank you,
Johan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:28:32+00:00Added an answer on June 15, 2026 at 9:28 pm

    DPIAwareness

    Just some ideas (not tried):

    Are you running on XP? That option might not work on that platform.

    • http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/5e60a54d-baf5-46e3-9eac-a959f2a0fba1/

    What follows are probably just different ways to set the same DpiAwareness option:

    • look at the “compatibility mode” settings on your EXE…right click it’s properties…and turn on “Disable display scaling”

    • create a manifest, and say you aren’t aware

      <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
       ...
        <asmv3:application>
          <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>false</dpiAware>
          </asmv3:windowsSettings>
        </asmv3:application>
       ...
      </assembly>
      
    • call SetProcessDPIAware (think you have to call this early i.e. before Window is created)

      http://msdn.microsoft.com/en-gb/library/windows/desktop/ms633543(v=vs.85).aspx

    You can call IsProcessDPIAware to check if your apps process has had the setting applied to it or not.

    Finding out the DPI

    Here’s how you find out what DPI you are currently using:

    Access CompositionTarget via the PresentationSource of your Window to find out what DPI scaling it’s using…..you can then use the values to do some scaling adjustments i.e. scale down your “stuff” (whose sizes/length/etc are specified in Device Independent Units), so that when its scaled up due to a higher DPI being in effect it doesn’t explode the physical pixel usage (…this can be done in various ways e.g. ViewBox, or calculations on widths, etc on elements ).

    double dpiX, double dpiY;
    PresentationSource presentationsource = PresentationSource.FromVisual(mywindow);
    
    if (presentationsource != null) // make sure it's connected
    {
        dpiX = 96.0 * presentationsource.CompositionTarget.TransformToDevice.M11;
        dpiY = 96.0 * presentationsource.CompositionTarget.TransformToDevice.M22;
    }
    
    • How do I convert a WPF size to physical pixels?
    • http://wpftutorial.net/DrawOnPhysicalDevicePixels.html

    Do Scaling Adjustments

    • use the ViewBox trick

      See this answer I made before that allowed a Canvas to use positions that were interpreted as “native” pixel no matter what the DPI scaling.

      WPF for LCD screen Full HD

    • access the TransFormToDevice scaling matrix on the CompositionTarget, and from that calculate a new matrix that just undoes that scaling and use that in LayoutTransform or RenderTransform.

    • use a method (maybe even put it in a Converter) that modifies a DIP (Device Independent Position) position/length on an explicit basis….you might do that if you want your Window Size to match a particular pixel size.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good Day all, i have been working with http://jsfiddle.net , the sample app i
Good day, Ive been having a hard time dealing with android notifications lately so
Good Day, I have a simple working routine in Perl that swaps two words:
Good day. I'm trying to filter logs with get-winevent. When I working with local
Good day, everyone. I need a compiled and ready-to-use Flash lib, which is able
Good day everybody. I've doing a bit of training at working with Flex and
Good day all, I am having some trouble with image permissions. I am loading
Good Day, My web app is set to use Windows Authentication and Impersontation is
Good day, I have a gen_server process which does some long-running state-updating tasks periodically
Good day, My app is a music playing app. I control the <audio> -Tag

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.