ConditionalAvailability (attribute)

From MXMS Wiki
Jump to navigationJump to search
An example usage of the Conditional availability attribute
An example usage of the Conditional availability attribute

The ConditionalAvailability attribute is used to show a property only when it's attribute condition is met. The condition must be defined in the class where the condition is defined. Determination of the condition is client side only.

Example

public virtual bool Enabled
{
    get; set;
}

[ConditionalAvailability("Enabled", ConditionalAvailabilityMode.Equals, true)]
public virtual string ConditionalProperty
{
    get; set;
}

In de example above property ConditionalProperty will be visible only when the Enabled Property is true. If a user changes the Enabled property the ConditionalProperty becomes available immediately without first saving.