Why does Windows8 behave different than windows7 when it comes to theming of some controls?

StackOverflow https://stackoverflow.com/questions/15364847

  •  23-03-2022
  •  | 
  •  

Question

as already mentiones in the topic I noticed that windows8 behaves different than windows7 converning some theming stuff of controls. The first time when I opened my application in windows8 I noticed follwing things:

Setting a background color for a combobox has no effect on windows8, works fine for textboxes though. I had to override the whole controltemplate for the combobox to get my desired color back for some comboboxes.

Another issue I got on windows 8 is, that all contents of my textboxes arent centered vertically anymore per default, all content is aligned to the top. In windows7 all content is centered vertically per default, without setting the VerticalContentAlignment Property. Well glady it wasn't required to override the whole template for the textbox again, as required before for the combobox. Setting the VerticalContentAlignment Property to "center" for all tetxboxes worked.

A 3rd issue I noticed so far, that I'm not able to show an icon in MenuItems larger than 16x16. All my MenuItems got an Icon with 20x20 size and showed fine in windows7. In Windows8 all my Icons got cropped to 16x16.

I used follwing code, which worked fine in Windows7:

<MenuItem Header="I'm a header">
   <MenuItem.Icon>
       <Image Source="Image.png" Height="20" Width="20" />
  </MenuItem.Icon>
</MenuItem>

...but didnt on windows8.

I bet there are more small issues on windows8 of that kind.

Anyone an idea what the reason is for that behavior in Windows8?

Was it helpful?

Solution 2

Simply extracting the template for the combobox and the menuitem WITHOUT making any changes and set it as style fixes the issue on windows8.

Now you can use the background property of the compbox as usual again, and setting the height and width for the menuitem icon works as well now.

OTHER TIPS

I had a look at the microsoft connect page and two of my described issues are already reported there as bugs, the combobox background thing and the cropping of the images to 16x16 for menuitems.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top