Show / Hide Table of Contents

Class RequiredImageAttribute

Used to specify that one or more form factors should be required.

Inheritance
object
Attribute
ValidationAttribute
ImageValidationAttribute
RequiredImageAttribute
Inherited Members
ImageValidationAttribute.RequiresValidationContext
ImageValidationAttribute.FormFactor
ImageValidationAttribute.IsValid(object)
ValidationAttribute.FormatErrorMessage(string)
ValidationAttribute.GetValidationResult(object, ValidationContext)
ValidationAttribute.Validate(object, ValidationContext)
ValidationAttribute.Validate(object, string)
ValidationAttribute.ErrorMessage
ValidationAttribute.ErrorMessageResourceName
ValidationAttribute.ErrorMessageResourceType
ValidationAttribute.ErrorMessageString
Attribute.Equals(object)
Attribute.GetCustomAttribute(Assembly, Type)
Attribute.GetCustomAttribute(Assembly, Type, bool)
Attribute.GetCustomAttribute(MemberInfo, Type)
Attribute.GetCustomAttribute(MemberInfo, Type, bool)
Attribute.GetCustomAttribute(Module, Type)
Attribute.GetCustomAttribute(Module, Type, bool)
Attribute.GetCustomAttribute(ParameterInfo, Type)
Attribute.GetCustomAttribute(ParameterInfo, Type, bool)
Attribute.GetCustomAttributes(Assembly)
Attribute.GetCustomAttributes(Assembly, bool)
Attribute.GetCustomAttributes(Assembly, Type)
Attribute.GetCustomAttributes(Assembly, Type, bool)
Attribute.GetCustomAttributes(MemberInfo)
Attribute.GetCustomAttributes(MemberInfo, bool)
Attribute.GetCustomAttributes(MemberInfo, Type)
Attribute.GetCustomAttributes(MemberInfo, Type, bool)
Attribute.GetCustomAttributes(Module)
Attribute.GetCustomAttributes(Module, bool)
Attribute.GetCustomAttributes(Module, Type)
Attribute.GetCustomAttributes(Module, Type, bool)
Attribute.GetCustomAttributes(ParameterInfo)
Attribute.GetCustomAttributes(ParameterInfo, bool)
Attribute.GetCustomAttributes(ParameterInfo, Type)
Attribute.GetCustomAttributes(ParameterInfo, Type, bool)
Attribute.GetHashCode()
Attribute.IsDefaultAttribute()
Attribute.IsDefined(Assembly, Type)
Attribute.IsDefined(Assembly, Type, bool)
Attribute.IsDefined(MemberInfo, Type)
Attribute.IsDefined(MemberInfo, Type, bool)
Attribute.IsDefined(Module, Type)
Attribute.IsDefined(Module, Type, bool)
Attribute.IsDefined(ParameterInfo, Type)
Attribute.IsDefined(ParameterInfo, Type, bool)
Attribute.Match(object)
Attribute.TypeId
object.Equals(object, object)
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: AdaptiveImages.Validation
Assembly: AdaptiveImages.dll
Syntax
[AttributeUsage(AttributeTargets.Property, Inherited = true)]
public class RequiredImageAttribute : ImageValidationAttribute

Constructors

RequiredImageAttribute()

Creates an attribute without any form factors specified.

Declaration
public RequiredImageAttribute()
Remarks

If no form factors are specified, all form factors are treated as required for AdaptiveImage properties.

RequiredImageAttribute(FormFactor)

Used to make one or more form factors required.

Declaration
public RequiredImageAttribute(FormFactor formFactor)
Parameters
Type Name Description
FormFactor formFactor
Remarks

Only applicable on AdaptiveImage properties. Form factor may not be specified if attribute is added to a SingleImage property.

Properties

AlternateText

Gets or sets whether the alternate text should be required, defaults to true.

Declaration
public bool AlternateText { get; set; }
Property Value
Type Description
bool
Remarks

Only applicable when images are set.

Images

Gets or sets whether images should be required, defaults to true.

Declaration
public bool Images { get; set; }
Property Value
Type Description
bool

Methods

IsValid(object?, ValidationContext)

Checks whether a SingleImage property has been set, or if one or more form factors of an AdaptiveImage have been set.

Declaration
protected override ValidationResult? IsValid(object? value, ValidationContext validationContext)
Parameters
Type Name Description
object value

The property being validated.

ValidationContext validationContext

Context from which the property and its owner instance are resolved.

Returns
Type Description
ValidationResult
Overrides
ValidationAttribute.IsValid(object, ValidationContext)
Exceptions
Type Condition
NotSupportedException

Extension Methods

ImageExtensions.GetCultureSpecificImageAttribute<TContent, TProperty>(TContent, Expression<Func<TContent, TProperty>>)
ImageExtensions.GetImageConstraints<TParent>(TParent, string)
ImageExtensions.GetImageConstraints<TParent, TProperty>(TParent, Expression<Func<TParent, TProperty>>)
ImageExtensions.GetImageRenderSettings<TParent, TProperty>(TParent, Expression<Func<TParent, TProperty>>)
ImageExtensions.GetImageRenderSettings<TParent, TProperty>(TParent, Expression<Func<TParent, TProperty>>, FormFactor)
ImageExtensions.GetProportionsConstraint<TParent>(TParent, string)
ImageExtensions.GetProportionsConstraint<TParent>(TParent, string, FormFactor)
ImageExtensions.GetProportionsConstraint<TParent, TProperty>(TParent, Expression<Func<TParent, TProperty>>)
ImageExtensions.GetRequiredImageAttribute<TContent, TProperty>(TContent, Expression<Func<TContent, TProperty>>)
ImageExtensions.GetSizeConstraint<TContent, TProperty>(TContent, Expression<Func<TContent, TProperty>>)
☀
☾
In this article
Back to top
Documentation applies to: Adaptive Images 2.x
☀
☾