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

Posted IWay

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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.'的主要内容,如果未能解决你的问题,请参考以下文章