WPF Combobox rendering on XP

我与影子孤独终老i 提交于 2019-12-23 03:34:13

问题


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:


XP:


回答1:


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" />



回答2:


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.



来源:https://stackoverflow.com/questions/4264288/wpf-combobox-rendering-on-xp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!