New to Telerik UI for WinForms? Start a free 30-day trial

A RangeMapper that wraps indices around, enabling continuous looping through the item collection.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
public class CircularRangeMapper : RangeMapper

Inheritance: objectRangeMapperCircularRangeMapper

Inherited Members RangeMapper.CreateLeft(Range, Range)RangeMapper.CreateRight(Range, Range)RangeMapper.ItemsCount

Constructors

C#
public CircularRangeMapper()

Methods

Chooses the occurrence of an item index, separated by multiples of the item count, nearest to the current index.

C#
public override int Closest(int curVal, int newValue)
Parameters:curValint

The current index in the unwrapped sequence.

newValueint

The item index whose nearest wrapped occurrence is requested.

Returns:

int

The closest occurrence, or newValue when the item count is zero.

Overrides: RangeMapper.Closest(int, int)

Determines whether an item index belongs to a range that may wrap across the collection boundary.

C#
public override bool IsInRange(Range range, int index)
Parameters:rangeRange

The range to test.

indexint

The item index to test.

Returns:

bool

true when the index is in the wrapped interval and within the collection bounds.

Overrides: RangeMapper.IsInRange(Range, int)

Wraps an index into the item collection using modulo arithmetic.

C#
public override int MapFromRangeIndex(int index)
Parameters:indexint

The index, which may be negative or exceed the item count.

Returns:

int

An index in the collection, or zero when ItemsCount is less than one.

Overrides: RangeMapper.MapFromRangeIndex(int)

Adjusts an index by at most one collection length so that it falls within a wrapped range.

C#
public override int Normalize(Range range, int index)
Parameters:rangeRange

The range that constrains the result.

indexint

The index to normalize.

Returns:

int

Zero when there are no items or the range is empty; otherwise, the adjusted index.

Overrides: RangeMapper.Normalize(Range, int)

Reduces the range's starting index by the item count and limits its span to at most one full collection; negative starts remain negative after the remainder operation.

C#
public override Range Normalize(Range source)
Parameters:sourceRange

The unnormalized range.

Returns:

Range

A range positioned using the starting index's remainder, or an empty range when there are no items.

Overrides: RangeMapper.Normalize(Range)