Skip to main content
A newer version of this page is available. .

Remove Redundant Type Qualifier (XAML)

Purpose

Removes a redundant type qualifier when the target type is defined, for example, on a style setter. This can improve code readability.

Availability

Available when the cursor is in a redundant type qualifier.

How to Use

  1. Place the caret in a property redundant type qualifier.
NOTE

The blinking cursor shows the caret's position where Refactoring is available.

<Style x:Key="checkBoxStyle" TargetType="{x:Type CheckBox}">
    <Setter Property="CheckBox.Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type CheckBox}">      
                <BulletDecorator Background="Transparent">
                    <BulletDecorator.Bullet>
                        <Grid Width="13" Height="13">
                            <Border x:Name="Border" 
                                Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}"/>
                            <Path x:Name="CheckMark" 
                                Stroke="{DynamicResource GlyphBrush}" 
                                StrokeThickness="2"
                                SnapsToDevicePixels="False"
                                Data="M 3 3 L 10 10 M 3 10 L 10 3"/>
                        </Grid>
                    </BulletDecorator.Bullet>
                </BulletDecorator>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
  1. Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.

  2. Select Remove Redundant Type Qualifier from the menu.

After execution, the Refactoring removes the redundant type qualifier.

RemoveQualifier