VerificationAttribute クラス
アセンブリ: System.Web (system.web.dll 内)

<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Property, AllowMultiple:=True)> _ Public NotInheritable Class VerificationAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Property, AllowMultiple=true)] public sealed class VerificationAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Property, AllowMultiple=true)] public ref class VerificationAttribute sealed : public Attribute

VerificationAttribute クラスのインスタンスは、検証できる、Web コンテンツのアクセシビリティ規則を定義します。『Web Content Accessibility Guidelines』の詳細については、W3C (World Wide Web Consortium) Web サイトを参照してください。
VerificationAttribute のインスタンスを定義するために必要な最小限の情報には、次のような種類があります。
-
検証規則によって表されるガイドライン。コンストラクタに指定された値によって、Guideline プロパティが設定されます。
-
規則が属するレポート レベルを表す VerificationReportLevel 列挙値。コンストラクタに指定された値によって、VerificationReportLevel プロパティが設定されます。
-
検証規則が true の場合にレポートされるメッセージ。コンストラクタに指定された値によって、Message プロパティが設定されます。
インスタンスの作成時に指定できる、検証規則のオプションのプロパティ。
-
検証規則を解釈する方法を表す VerificationRule 列挙値。コンストラクタに指定された値によって、VerificationRule プロパティが設定されます。
-
検証規則をテストするために使用する条件式の演算子を表す VerificationConditionalOperator 列挙値。コンストラクタに指定された値によって、VerificationConditionalOperator プロパティが設定されます。
-
アクセシビリティ リファレンス ガイドラインの URL。コンストラクタに指定された値によって、GuidelineUrl プロパティが設定されます。
-
条件式の右辺を表す条件値。コンストラクタに指定された値によって、ConditionalValue プロパティが設定されます。
-
条件式の左辺を表す条件付きプロパティ。コンストラクタに指定された値によって、ConditionalProperty プロパティが設定されます。

VerificationAttribute クラスを使用するコード例を次に示します。検証のメタデータ定義で使用するガイドラインは、"WCAG" (Web Content Accessibility Guideline) および "ADA" (Americans with Disabilities Act Guidelines) です。詳細については、W3C (World Wide Web Consortium) Web サイトを参照してください。
使用するチェックポイントは、WCAG の場合は "1.1"、ADA の場合は "1194.22(a)" です。これらのチェックポイントは、テキスト以外の要素に等価のテキストが確実に存在するようにします。VerificationAttribute は、ImageProperty という名前の別のプロパティと等価のテキストを表す ImageText プロパティに適用されます。ImageText プロパティが設定されていない場合、アクセシビリティの検証によって "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 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
[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; } }


System.Attribute
System.Web.UI.VerificationAttribute


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- VerificationAttribute クラスのページへのリンク