I am creating a video editing application with WPF. I have a slider with a Maximum value of 1000. I have an image and its image source is bound to a file path in a list of ImageFrameModels where the slider value is the indexer of the list. I am going crazy for the last two days trying to accomplish the following:
When the slider reaches the end of the control which is the Maximum value for the slider, I need the ImageFrameModels index to continue to increment. As well as incrementing the sliders maximum and minimum values. When I move the slider thumb backwards I need it to stop incrementing. I am trying to imitate scrubbing or scrolling through the video.
I have tried incrementing properties that are data bound to the slider value, slider max and slider min as follows:
private int sliderValue;
public int SliderValue
{
get { return sliderValue; }
set
{
if(sliderValue != value)
{
sliderValue = value;
NotifyPropertyChanged(nameof(SliderValue));
if(SliderValue == SliderMax)
{
SliderMax ;
SliderMin ;
SliderValue ;
NotifyPropertyChanged(nameof(SliderValue));
NotifyPropertyChanged(nameof(SliderMin));
NotifyPropertyChanged(nameof(SliderMax));
}
}
}
}
This only fired one time. I have to continue to move the slider thumb to get it to fire again. I need a loop or something that keeps running while the slider its at the end of the control and stops with it is not.
This may not be possible but I would appreciate any help or advice you have.
CodePudding user response:
You need to think about how to start and stop repetitive addition of maximum value as well as its interval. Probably it should be directly linked with user's input (e.g. press and hold slider thumb at maximum position).
Such functionaly will need close interaction with user's input and so it can and should be handled in view, probably custom slider, rather than view model.