TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
XAML Coding Standard
Search

RES$002Checked automatically with code checker

Synopsis:Do use StaticResource to define the based-on type for implicit styles
Language:XAML
Severity Level:1
Category:Resources


Description:

If you define an implicit style (see below for why you should want to define implicit styles), you have no choice but to use a static resource, even if the resource cannot be resolved at compile-time. On purpose, it is not allowed to use a dynamic resource in a based-on style.

  <!-- Define an implicit style.
    Note that an implicit style should not have an x:Key. -->
<Style
    BasedOn="{StaticResource MyCustomButtonStyle}"
    TargetType="{x:Type Button}">
    <Setter Property="Width" Value="120"/>
    <Setter Property="Height" Value="38"/>
</Style>