This document covers the reusable IntegerSlider control used across the app for integer-valued ranges.
IntegerSlider is a WPF UserControl that pairs a label, a custom thumb, a floating value popup, and optional tick labels. It is used when the UI needs an integer range with visual position feedback, not a plain Slider.
IntegerSlider is used in these places:
Components/EncoderPreviewPanel.xamlfor preview position selectionComponents/VpyPreviewPanel.xamlfor VapourSynth preview position selectionComponents/EncoderRateControlPanel.xamlfor CRF and ABR controlsComponents/EncoderCustomParamsPanel.xamlfor keyframe interval controlsComponents/EncoderAutoParamsPanel.xamlfor ffprobe automatic-parameter tuningComponents/EncodingMonitor.xamlfor sample interval controlViews/SampleClipModal.xamlfor clip durationViews/ParallelismConfModal.xamlfor thread countViews/FilterScribeModal.xamlfor crop and scale values
<comps:IntegerSlider Grid.Column="1"
Minimum="0"
Maximum="{Binding MaxValue}"
Value="{Binding CurrentValue, Mode=TwoWay}"
TickLabels="{Binding Labels}"
TickCount="5"
LabelWidth="0"
HorizontalAlignment="Stretch" />When the tick labels are formatted rather than plain numbers, pair them with explicit values so the positions stay correct and the popup can show a different text:
<comps:IntegerSlider Minimum="100"
Maximum="300"
Step="10"
Value="{Binding X264AutoLookaheadPercent, Mode=TwoWay}"
ValueText="{Binding X264LookaheadDisplay, Mode=OneWay}"
TickLabels="{Binding AutoLookaheadLabels}"
TickLabelValues="{Binding AutoLookaheadValues}" />MinimumandMaximumdefine the integer range.Valueis the bound selection.TickLabelssupplies the displayed labels under the track.TickLabelValuesoptionally pairs each label with a numeric value, so labels can be formatted freely (for example×1.8) instead of starting with the number used for positioning.TickCountkeeps the track layout stable when labels are present.Stepsnaps movement to a fixed integer increment.SnapToTickskeeps the selected value aligned to ticks.IsLogarithmicswitches the position math to a logarithmic scale.
In ImgPreviewerVM, the preview slider is initialized from source ffprobe data. When source stats are available, PreviewPositionSeconds starts near the middle of the available range; otherwise it starts at 0.
- The thumb position is calculated from
Minimum,Maximum, andValue. - The popup and tick labels use the same range math, so they stay aligned with the thumb.
MaximumandTickCountchanges re-clamp the current value.