1. 程式人生 > >WPF在win7運行時報'Initialization of 'System.Windows.Setter' threw an exception.'

WPF在win7運行時報'Initialization of 'System.Windows.Setter' threw an exception.'

sys pan present color 一個 exce name soft exceptio

寫的一個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.'