1

I have a DataTemplate giving items for display in both a ListBox and a ComboBox. The window I have created looks like this: Screenshot http://img223.imageshack.us/img223/8117/datatemplateexampletz4.png

The question I have is why the DataTemplate in the ComboBox is blurrier or slightly more pixellated than the display in the ListBox. It is quite difficult to see on the screenshot, but it seems more noticeable when I'm actually using the application. Any idea why this is happening? Is it something to do with ClearType being enabled for one control and not for the other?

Any ideas would be appreciated. I can post the code if needed.

robintw
  • 27,571
  • 51
  • 138
  • 205

3 Answers3

1

This effect seems to be especially noticeable on the "Adobe" letters on the icon. Since I assume that the icon is some kind of graphic, this is not related to ClearType which is only marginally useful under WPF anyways, but a more general problem. One usual suspect is be pixel snapping.

Community
  • 1
  • 1
David Schmitt
  • 58,259
  • 26
  • 121
  • 165
  • I was actually thinking more about the text in the ComboBox - it seems to be less clear and the edges seem to be less sharp than the text in the ListBox. Any ideas on that? – robintw Feb 03 '09 at 14:22
  • Regarding Text in WPF, I can only point you to the post I've already linked to: http://stackoverflow.com/questions/190344/wpf-blurry-fonts-problem-solutions/190521#190521 summary: current WPF text rendering quality is optimized for smooth animations, not pixel grid snapping. – David Schmitt Feb 03 '09 at 15:46
1

It's because the images are not aligned with the pixel grid, you can either give everything explicit sizes and positions that are aligned or use an alternative image control, see this post on my blog:

http://www.nbdtech.com/blog/archive/2008/11/20/blurred-images-in-wpf.aspx

Nir
  • 29,306
  • 10
  • 67
  • 103
1

The text blurriness on ComboBox when compared to ListBox is because ClearType is disabled on popups (including the one for ComboBox). This has been confirmed by Microsoft.

From the linked article:

In a popup, which is a separate Win32 window, there's no way of the WPF ClearType system knowing what pixels are behind (without doing various dubious and slow win32 tricks) so it's simply disabled.

Robert Macnee
  • 11,650
  • 4
  • 40
  • 35