首页 > 代码库 > WPF在win7运行时报'Initialization of 'System.Windows.Setter' threw an exception.'

WPF在win7运行时报'Initialization of 'System.Windows.Setter' threw an exception.'

写的一个WPF程序,在win10运行好好的,在win7就报‘Initialization of ‘System.Windows.Setter‘ threw an exception.‘

原来是xaml使用了xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"

并且dll引用了PresentationFramework.Aero2

那么只要改为

xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"

dll引用改为PresentationFramework.Aero,就可以兼容win7了

WPF在win7运行时报'Initialization of 'System.Windows.Setter' threw an exception.'