WPF Combobox rendering on XP

2019-06-07 21:25发布

I have a problem with a simple combobox rendering on XP.

The code is just:

<ComboBox Cursor="Hand" customCommands:ComboBoxSelectionChange.Command="{Binding StatusChange}" ItemsSource="{Binding AvailabilityStatusList}"/>

However, the result on different OSs is not quite i've expected:

Vista: Combobox Vista
XP: Combobox XP

2条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-06-07 22:16

You can force a WPF application to apply a certain Windows standard scheme, regardless of the current Windows Version (e.g. XP vs. Vista).

To force you application to use the Aero theme (Vista), put this in your App.xaml:

  <!-- Use the Aero scheme for your application, regardless the currently applied Windows Theme or OS Version. -->
    <ResourceDictionary
        Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral, 
        PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />
查看更多
▲ chillily
3楼-- · 2019-06-07 22:23

The ComboBox -like most other controls- takes into account the OS theme, so that your user interface will be consistent with the rest of the OS surface.

If you want to create an "OS-agnostic" look (i.e. keep the same look across different operating systems) you have to re-template it.

查看更多
登录 后发表回答