Unused styles in resources are not detected

Hello. I have the following Silverlight 3 User Control and I am using R# 5 with Visual Studio 2008 SP1:

<UserControl

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:FinancialApps_Client_WCFService="clr-namespace:FinancialApps.Client.WCFService" x:Class="FinancialApps.Client.Views.PublicationManager.MagazinesUC"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="FinancialApps_Client_WCFService">

    <UserControl.Resources>

        <DataTemplate x:Key="ItemTemplate">

            <StackPanel>

                <TextBlock Text="{Binding Name}" />

            </StackPanel>

        </DataTemplate>

        <Style x:Key="CheckBoxItemContainerStyle" TargetType="ListBoxItem">

        

        </Style>

    </UserControl.Resources>

 

    <Grid x:Name="LayoutRoot" Background="White">

        <ListBox x:Name="magazinesListBox" MinHeight="250" MinWidth="250">

            <ListBox.ItemTemplate>

                <DataTemplate>

                    <CheckBox IsChecked="{Binding Checked, Mode=TwoWay}" Content="{Binding Name}" />

                </DataTemplate>

            </ListBox.ItemTemplate>

        </ListBox>

 

        <!-- <ListBox x:Name="magazinesListBox" ItemTemplate="{StaticResource ItemTemplate}" ItemContainerStyle="{StaticResource CheckBoxItemContainerStyle}"  SelectionMode="Extended"  MinWidth="250" MinHeight="250"/>  -->

    </Grid>

</UserControl>

 

ReSharper correctly identifies that the resource "ItemTemplate" is not being used and marks it with the light gray color and it can be removed using the action list. ReSharper however does not detect that the style "CheckBoxItemContainerStyle" is unused as well and that it can be removed too.

4 comments
Comment actions Permalink

Gabriel,
it might affect performance significantly if we check control types against styles' target types. So we decided to leave such styles unchecked.

0
Comment actions Permalink

Even if you would only check the resources declared in the user control?

0
Comment actions Permalink

In fact, it might take time. I'll try to do my best.

0
Comment actions Permalink

Gabriel,
I think, I've implemented the highlighting properly. Try the tomorrow's nightly, please.

0

Please sign in to leave a comment.