Added Scenario and expanded API

This commit is contained in:
Tig
2024-08-05 17:44:48 -06:00
parent de10e22b22
commit c0fc83bd78
4 changed files with 370 additions and 21 deletions

View File

@@ -146,7 +146,8 @@ public class NumericUpDown<T> : View where T : notnull
/// <remarks>
/// <para>
/// <see cref="ValueChanging"/> and <see cref="ValueChanged"/> events are raised when the value changes.
/// The <see cref="ValueChanging"/> event can be canceled the change setting <see cref="CancelEventArgs{T}.Cancel"/> to
/// The <see cref="ValueChanging"/> event can be canceled the change setting
/// <see cref="CancelEventArgs{T}.Cancel"/> to
/// <see langword="true"/>.
/// </para>
/// </remarks>
@@ -175,6 +176,17 @@ public class NumericUpDown<T> : View where T : notnull
}
}
/// <summary>
/// Raised when the value is about to change. Set <see cref="CancelEventArgs{T}.Cancel"/> to true to prevent the
/// change.
/// </summary>
public event EventHandler<CancelEventArgs<T>>? ValueChanging;
/// <summary>
/// Raised when the value has changed.
/// </summary>
public event EventHandler<EventArgs<T>>? ValueChanged;
private string _format = "{0}";
/// <summary>
@@ -191,30 +203,47 @@ public class NumericUpDown<T> : View where T : notnull
}
_format = value;
FormatChanged?.Invoke (this, new (value));
SetText ();
}
}
/// <summary>
/// Raised when <see cref="Format"/> has changed.
/// </summary>
public event EventHandler<EventArgs<string>>? FormatChanged;
private void SetText ()
{
_number.Text = string.Format (Format, _value);
Text = _number.Text;
}
/// <summary>
/// Raised when the value is about to change. Set <see cref="CancelEventArgs{T}.Cancel"/> to true to prevent the
/// change.
/// </summary>
public event EventHandler<CancelEventArgs<T>>? ValueChanging;
/// <summary>
/// Raised when the value has changed.
/// </summary>
public event EventHandler<EventArgs<T>>? ValueChanged;
private T _increment;
/// <summary>
/// </summary>
public T Increment { get; set; }
public T Increment
{
get => _increment;
set
{
if (_increment == (dynamic)value)
{
return;
}
_increment = value;
IncrementChanged?.Invoke (this, new (value));
}
}
/// <summary>
/// Raised when <see cref="Increment"/> has changed.
/// </summary>
public event EventHandler<EventArgs<T>>? IncrementChanged;
}
/// <summary>