ערוך

שתף באמצעות


VerificationAttribute Class

Definition

Defines the metadata attribute of a Web content accessibility rule. This class cannot be inherited.

public ref class VerificationAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Property, AllowMultiple=true)]
public sealed class VerificationAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Property, AllowMultiple=true)>]
type VerificationAttribute = class
    inherit Attribute
Public NotInheritable Class VerificationAttribute
Inherits Attribute
Inheritance
VerificationAttribute
Attributes

Examples

The following code example demonstrates using the VerificationAttribute class. In the verification metadata definition, the guidelines used are "WCAG," the Web Content Accessibility Guideline, and "ADA," Americans with Disabilities Act Guidelines. For more information, see the World Wide Web Consortium (W3C) Web site.

The checkpoints used are "1.1" and "1194.22(a)" for WCAG and ADA, respectively, checkpoints for ensuring that a text equivalent exists for non-text elements. The VerificationAttribute is applied to the ImageText property that represents the text equivalent of another property called ImageProperty. If the ImageText property is not set, the accessibility verification will return the message "The image is missing a text equivalent."

[Verification("ADA", "1194.22(a)", 
    VerificationReportLevel.Error, 1,
    "The image is missing a text equivalent.", 
    VerificationRule.NotEmptyString, "ImageUrl"),
Verification("WCAG", "1.1", 
    VerificationReportLevel.Error, 1, 
    "The image is missing an text equivalent.", 
    VerificationRule.NotEmptyString, "ImageUrl")]
public virtual String ImageText
{
    get
    {
        object obj = ViewState["ImageText"];
        return ((obj == null) ? String.Empty : (string)obj);
    }
    set
    {
        ViewState["ImageText"] = value;
    }
}
public virtual String ImageUrl
{
    get 
    {
        object obj = ViewState["ImageUrl"];
        return ((obj == null) ? String.Empty : (string)obj);
    }
    set 
    { 
        ViewState["ImageUrl"] = value;
    }
}
<Verification("ADA", "1194.22(a)", VerificationReportLevel.Error, 1, "The image is missing a text equivalent.", VerificationRule.NotEmptyString, "ImageUrl")> _
<Verification("WCAG", "1.1", VerificationReportLevel.Error, 1, "The image is missing a text equivalent.", VerificationRule.NotEmptyString, "ImageUrl")> _
Public Property ImageText() As String
    Get
        If ViewState("ImageText") Is Nothing Then
            Return String.Empty
        Else
            Return CType(ViewState("ImageText"), String)
        End If
    End Get
    Set(ByVal value As String)
        ViewState("ImageText") = value
    End Set
End Property


Public Property ImageUrl() As String
    Get
        If ViewState("ImageUrl") Is Nothing Then
            Return String.Empty
        Else
            Return CType(ViewState("ImageUrl"), String)
        End If
    End Get
    Set(ByVal value As String)
        ViewState("ImageUrl") = value
    End Set
End Property

Remarks

An instance of the VerificationAttribute class defines a Web content accessibility rule that can be verified. For more information on Web Content Accessibility Guidelines, see the World Wide Web Consortium (W3C) Web site.

The minimal amount of information required to define an instance of a VerificationAttribute includes:

  • A guideline that the verification rule represents. The value specified in the constructor sets the Guideline property.

  • A checkpoint of the guideline. The value specified in the constructor sets the Checkpoint property.

  • A checkpoint priority. The value specified in the constructor sets the Priority property.

  • A VerificationReportLevel enumeration value that represents the reporting level that should be rule belongs to. The value specified in the constructor sets the VerificationReportLevel property.

  • A message that is reported when the verification rule is true. The value specified in the constructor sets the Message property.

Optional properties of the verification rule that can be specified when creating an instance:

  • A VerificationRule enumeration value that represents how the verification rule should be interpreted. The value specified in the constructor sets the VerificationRule property.

  • A VerificationConditionalOperator enumeration value that represents the operator in the conditional expression used to test the verification rule. The value specified in the constructor sets the VerificationConditionalOperator property.

  • An accessibility reference guideline URL. The value specified in the constructor sets the GuidelineUrl property.

  • A conditional value representing the right side of a conditional expression. The value specified in the constructor sets the ConditionalValue property.

  • A conditional property representing the left side of a conditional expression. The value specified in the constructor sets the ConditionalProperty property.

The VerificationAttribute metadata can be defined class, property, and indexer declarations.

For more information about using attributes, see Attributes.

Constructors

VerificationAttribute(String, String, VerificationReportLevel, Int32, String)

Initializes a new instance of the VerificationAttribute class with accessibility guideline, checkpoint, reporting level, checkpoint priority, and error message.

VerificationAttribute(String, String, VerificationReportLevel, Int32, String, VerificationRule, String)

Initializes a new instance of the VerificationAttribute class with accessibility guideline, checkpoint, reporting level, checkpoint priority, error message, VerificationRule.value, and related conditional property.

VerificationAttribute(String, String, VerificationReportLevel, Int32, String, VerificationRule, String, VerificationConditionalOperator, String, String)

Initializes a new instance of the VerificationAttribute class with accessibility guideline, checkpoint, reporting level, checkpoint priority, error message, VerificationRule.value, related conditional property, a related conditional property value, and a reference guideline URL.

Properties

Checkpoint

Gets the accessibility checkpoint reference in the specified Guideline property.

ConditionalProperty

Gets the left side of a conditional expression used as part of the verification accessibility checkpoint.

ConditionalValue

Gets the right side of a conditional expression used as part of the verification accessibility checkpoint.

Guideline

Gets the guideline that used for accessibility checking.

GuidelineUrl

Gets the URL the can be used to get more information on the accessibility guidelines given in the Guideline property.

Message

Gets a message string when the accessibility checkpoint verification rule is true.

Priority

Gets the priority of the accessibility checkpoint.

TypeId

When implemented in a derived class, gets a unique identifier for this Attribute.

(Inherited from Attribute)
VerificationConditionalOperator

Gets a VerificationConditionalOperator enumeration value indication how the accessibility checkpoint is verified.

VerificationReportLevel

Gets a VerificationReportLevel enumeration value indicating how the accessibility checkpoint is used.

VerificationRule

Gets a VerificationRule enumeration value indicating how the accessibility checkpoint is used.

Methods

Equals(Object)

Returns a value that indicates whether this instance is equal to a specified object.

(Inherited from Attribute)
GetHashCode()

Returns the hash code for this instance.

(Inherited from Attribute)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
IsDefaultAttribute()

When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Inherited from Attribute)
Match(Object)

When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Inherited from Attribute)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Retrieves the type information for an object, which can be used to get the type information for an interface.

(Inherited from Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Provides access to properties and methods exposed by an object.

(Inherited from Attribute)

Applies to

See also