Repository navigation
Description
Sometimes a custom Step Size would be really useful, which would change by how much the arrows change the value. Implementation in the OnIncrease and OnDecrease method as follows:
/// <summary>
/// Increase the displayed integer value
/// </summary>
protected virtual void OnIncrease()
{
if (this.Value >= this.MaxValue)
{
// Value is not incremented if it is already maxed or above
this.Value = this.MaxValue;
}
else
{
if (this.Value + this.StepSize <= this.MaxValue)
this.Value = (int) (this.Value + this.StepSize);
else
{
if (this.Value <= this.MinValue)
{
// Value is not incremented if it is already min or below
this.Value = this.MinValue;
}
}
}
}
/// <summary>
/// Decrease the displayed integer value
/// </summary>
protected virtual void OnDecrease()
{
if (this.Value <= this.MinValue)
{
// Value is not decremented if it is already minimum or below
this.Value = this.MinValue;
}
else
{
if (this.Value - this.StepSize > this.MinValue)
this.Value = (int) (this.Value - this.StepSize);
else
{
if (this.Value >= this.MaxValue)
{
// Value is not incremented if it is already maxed or above
this.Value = this.MaxValue;
}
}
}
}
Metadata
Metadata
Assignees
Labels
No labels
Activity
Implemented StepSize dependency property
Dirkster99 commentedon Jun 28, 2018
Thanks for the good feature description - its implemented with version 1.0.3 of the library and nuget package (it may take some time until you can download the opackage:
Dirkster.NumericUpDownLib 1.0.3
as soon as its available on nuget (usually 30-60 mins).
I close this assuming its resolved but feel free to re-open should you find problems with this.
Install-Package Dirkster.NumericUpDownLib -Version 1.0.3Merge pull request #50 from jholzer/master
Revert "Fix #1: FormatString not working with custom texts, Fix #2: C…
Merge pull request #51 from Dirkster99/revert-50-master