Skip to main content
Version: 4.1

IReadOnlyExtensions

Namespace: Wisej.Web.Markup

Assembly: Wisej.Framework (4.1.0.0)

Adds fluent markup extension methods to the IReadOnly implementation.

public class IReadOnlyExtensions

Methods

Static member OnReadOnlyChanged<TReadOnly>(target, action)

Attaches an action to be executed when the ReadOnlyChanged event is raised.

ParameterTypeDescription
TReadOnlyThe type that implements IReadOnly.
targetTReadOnlyThe target object whose ReadOnlyChanged event is being monitored.
actionAction<TReadOnly>The action to execute when the ReadOnlyChanged event occurs.

Returns: TReadOnly. The target object, allowing for method chaining.

This extension method allows you to easily attach an action to the ReadOnlyChanged event of an object.


myReadOnlyObject.OnReadOnlyChanged(obj => AlertBox.Show("ReadOnly state changed."));

Static member ReadOnly<TReadOnly>(target, value)

Sets the read-only status of the specified target object.

ParameterTypeDescription
TReadOnlyThe type of the target object, which must implement IReadOnly.
targetTReadOnlyThe target object whose read-only status is to be set.
valueBooleanA boolean value indicating the desired read-only status.

Returns: TReadOnly. The target object with the updated read-only status.

This extension method allows you to set the read-only status of an object that implements the IReadOnly interface.


var myObject = new MyReadOnlyObject();
myObject.ReadOnly(false);