2012-10-20 36 views
0

每個新的Windows 8 C#Metro項目都包含StandardStyles.xaml文件,其中包含許多用於各種控件的樣式和模板。大多數情況下,我只使用其中的10%,我定義了很多我自己的風格。如何刪除StandardStyles.xaml中未使用的樣式?

熱可以輕鬆安全地找到和/或刪除所有未使用的樣式?據我所知,解析長XAML文件增加了我的Windows 8應用程序的啓動時間,這是我想避免的。或者你認爲我不應該關心1800行代碼?

+0

如果您不確定這是一個問題,爲什麼不嘗試使用/不使用? – mydogisbox

回答

3

標題中的評論給你一個不錯的主意:

This file contains XAML styles that simplify application development. 

These are not merely convenient, but are required by most Visual Studio project and item templates. 
Removing, renaming, or otherwise modifying the content of these files may result in a project that 
does not build, or that will not build once additional pages are added. If variations on these 
styles are desired it is recommended that you copy the content under a new name and modify your 
private copy. 

如果修改然後將該文件再添加另一種觀點認爲,你可能會堅持不工作視圖你將不得不弄清楚你需要重新添加哪些樣式。

這個文件的開銷很小,我不擔心它是如何影響你的啓動時間的,因爲幾乎所有其他的XAML應用程序都會有相同的開銷。

+0

我想StandardStyles.xaml的解析開銷是可以接受的,我們應該更關心在我們的應用程序中需要更多時間的問題。 –