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

  • Home
  • SEARCH
  • 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 720907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:48:44+00:00 2026-05-14T05:48:44+00:00

Can anyone suggest a guideline on when to use SnapsToDevicePixels in WPF 4.0? Should

  • 0

Can anyone suggest a guideline on when to use SnapsToDevicePixels in WPF 4.0?

Should it only be used occasionally if there is an issue, liberally throughout an App, only on certain controls or what?

  • 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-05-14T05:48:44+00:00Added an answer on May 14, 2026 at 5:48 am

    Good answers by Spencer and Martin as to the when to align your pixels.

    As to the how: I would also point out that one should in WPF 4.0 try using the property UseLayoutRounding instead of SnapsToDevicePixels.

    UseLayoutRounding makes what you are doing compatible with Silverlight (SnapsToDevicePixels is not available in Silverlight) … and Microsoft is also encouraging the use of UseLayoutRounding over SnapsToDevicePixels in its documentation.

    What is the difference between the two? Well, one big difference is that UseLayoutRounding occurs during the layout phase while SnapsToDevicePixels occurs during the render phase. This makes me speculate that UseLayoutRounding is probably a more performant way to go (I haven’t confirmed this, though).

    All that being said, there will still be reasons to use SnapsToDevicePixels. In fact, the MSDN documentation points to one. I will add another: it is only with SnapsToDevicePixels that you can use guidelines for precise control.

    Here are some resources on this matter (i.e. pixel snapping and clarity with images, text, and visuals):

    • The MSDN Documentation for the UIElement.SnapsToDevicePixels Property.
    • The MSDN Documentation for the FrameworkElement.UseLayoutRounding Property.
    • Here is the old, classic post by Dwayne Need on blurry images.
    • Sometimes BitmapScalingMode helps with image clarity.
    • A great blog post that shows you how to actually use SnapsToDevicePixels. It can be tricky.
    • A blog post by the WPF Text team about all the different improvements they added to WPF 4.0 in order to help text clarity.
    • Another blog post by the WPF Text team on layout rounding.

    Heh. I know my answer was a little more than what you were asking for … but this concept (i.e. resolution independence and the resulting problems it brings and how to get over them) can often be a point of frustration when working with WPF. At the very least, I wanted to point you to the new WPF 4.0 property, UseLayoutRounding.

    UPDATE

    I just have to add since I’ve seen this over and over … sometimes SnapsToDevicePixels works when UseLayoutRounding doesn’t. I wish I could put a finger on why this is the case, but definitely try UseLayoutRounding first and if that doesn’t work, don’t hesitate to try SnapsToDevicePixels.

    That line is so sharp it can cut you!

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

Sidebar

Related Questions

Can anyone suggest which extensibility point i should use if i want to execute
Can anyone suggest me a helpful programming language which can be used to create
Can anyone suggest a good reason to use web services instead of RPC (not
Can anyone suggest a pattern that can be used for writing a JavaScript API
Can anyone suggest a good control that can be used to display images (png's
Can anyone suggest a VNC package that allows for a C#/WPF application to pull
Can anyone suggest me how can I use a refresh icon in my activity?
Can anyone suggest me why when there are no translation for a field it
Can anyone suggest some good browser add-on tools/extensions to help with development? I have
Can anyone suggest a way of getting version information into a Web Service? (VB.NET)

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.