C#-InvalidDependencyPropertyDeclaration

Follow the guidelines for creating dependency properties

Required inputs: CSharpAST

This rule checks whether a dependency property has been properly declared (see also this guideline).
  • A regular CLR property (having the name given in the register invocation) has to be provided.
  • The dependency property static field has to be named by suffixing the name of the property with "Property".

Possible Messages

Key

Text

Severity

Disabled

not_found

Could not find CLR property accessors for dependency property “{0}”.

None

False

unexpected_name

Expected the name “{0}Property” for declaring static field of dependency property “{0}”.

None

False

Options

check_name_of_static_field

check_name_of_static_field : bool = True

Check whether the declaring static field has the recommended name.
 

dependency_property_class

dependency_property_class : str = 'System.Windows.DependencyProperty'

The name of the DependencyProperty class including namespaces.
 

register_methods

register_methods : list[str] = ['Register']

List of method names that are used for registering dependency properties.