Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slider needs a Direction property. #388

Open
Release opened this issue Oct 17, 2023 · 5 comments
Open

Slider needs a Direction property. #388

Release opened this issue Oct 17, 2023 · 5 comments

Comments

@Release
Copy link

Release commented Oct 17, 2023

TrackBar control increases the value when the mouse wheel is moved up, while Slider decreases it.
It needs a property that would change this behavior to the opposite.

@valimaties
Copy link

valimaties commented Oct 31, 2023

Solved. Now I hope leo to merge it 😁

@Release
Copy link
Author

Release commented Oct 31, 2023

Thanks, it also lacks the property of adjusting the value change step. To be able to set the scrolling step different from the one set in the system. Something like that:

public enum Directions { Normal, Reverse }

protected override void OnMouseWheel(MouseEventArgs e)
{
	int scrollLines = SystemInformation.MouseWheelScrollLines;

	Value += e.Delta / 40 / scrollLines * StepChange * (ScrollDirection == Directions.Normal ? 1 : -1);
	Value = Math.Clamp(Value, RangeMin, RangeMax);

	onValueChanged?.Invoke(this, Value);
}

[DefaultValue(2)]
[Category("Material Skin")]
[Description("Define control step change value")]
public int StepChange
{
	get => stepChange;
	set => stepChange = Math.Clamp(value, 1, RangeMax);
}

[DefaultValue(Directions.Normal)]
[Category("Material Skin")]
[Description("Define control direction change value with mouse wheel")]
public Directions ScrollDirection { get; set; }

@valimaties
Copy link

Make a PR please and I will delete mine.

@Release
Copy link
Author

Release commented Nov 1, 2023

@valimaties, judging by this post, the edits will probably never be accepted.

@Taiizor
Copy link

Taiizor commented Jan 10, 2024

@valimaties, judging by this post, the edits will probably never be accepted.

You can take a look at this project. I will add your changes as PR in a moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants