Description
The ValueChanged
property of the GradientEditorWidget
class is an event handler that is triggered whenever the gradient value is modified. It is a delegate of type System.Action<Sandbox.Gradient>
, which means it can be assigned a method that takes a Sandbox.Gradient
as a parameter and returns void.
Usage
To use the ValueChanged
property, you need to assign a method to it that matches the delegate signature. This method will be called whenever the gradient value changes, allowing you to perform custom actions in response to the change.
Example
// Example of using the ValueChanged property
GradientEditorWidget gradientEditor = new GradientEditorWidget();
// Define a method that matches the delegate signature
void OnGradientValueChanged(Sandbox.Gradient newGradient)
{
// Handle the gradient change
// For example, update a UI element or log the change
}
// Assign the method to the ValueChanged property
gradientEditor.ValueChanged = OnGradientValueChanged;
// Now, whenever the gradient value changes, OnGradientValueChanged will be called