WPF關於Generic.xaml


如果需要用到Themes/Generic.xaml作為默認風格資源文件,不要忘了該項目的AssemblyInfo.cs中必須要有以下這段:

[assembly: ThemeInfo(
    ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
    //(used if a resource is not found in the page, 
    // or application resource dictionaries)
    ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
    //(used if a resource is not found in the page, 
    // app, or any theme specific resource dictionaries)
)]

否則,程序將自動取當前操作系統風格。

這段沒有的原因很可能是WPF項目是從別處拷來而不是直接在vs里創建的。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM