简体   繁体   English

WPF / Silverlight样式分析器

[英]Style analyzer for WPF/Silverlight

I am looking for a utility that will go through all XAML files in a project and locate defined styles that aren't being used anywhere. 我正在寻找一个实用程序,它将遍历项目中的所有XAML文件,并找到未在任何地方使用的已定义样式。

does such a tool exist? 这样的工具存在吗?

No there is no such tool, as much as I aware of. 没有这样的工具,就像我所知道的那样。

You can use simple Find of VisualStudio , or Expression Blend , or XamlPad (which is free). 您可以使用简单的Find of VisualStudio ,或Expression BlendXamlPad (免费)。

Hope this helps. 希望这可以帮助。

If the style is in the same File ReSharper does a pretty good job at showing unused styles, converter, etc... by graying them out a bit. 如果样式在同一个文件中, ReSharper在显示未使用的样式,转换器等方面表现相当不错......稍微将它们变灰。 There is a 30-day trial version available. 有30天的试用版。

That's how it looks: 这就是它的样子:

I did a small application for this purpose for Silverlight styles. 为了这个目的,我为Silverlight样式做了一个小应用程序。 It should be surely adaptable for WPF. 它肯定适用于WPF。 The source code and binary may be found here: 源代码和二进制文件可以在这里找到:

Removing unused styles from Silverlight projects 从Silverlight项目中删除未使用的样式

Rgds, RGDS,

Bruno 布鲁诺

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM