Class ScrollAxisBase
ScrollAxisBase is an abstract base class and implements scrolling
logic for both horizontal and vertical scrolling in a
ScrollAxisBase has support for frozen header and footer lines, maintaining a scroll position and updating and listening to scrollbars. It also maintains a collection of VisibleLineInfo items for all the lines that are visible in the viewing area. ScrollAxisBase wires itself with a ScrollLinesHost and reacts to changes in line count, line sizes, hidden state and default line size.
Implements
Namespace: Syncfusion.UI.Xaml.ScrollAxis
Assembly: Syncfusion.SfGrid.WPF.dll
Syntax
public abstract class ScrollAxisBase : Object, IDisposable
Constructors
ScrollAxisBase(IScrollBar, ILineSizeHost)
Initializes a new instance of the ScrollAxisBase class.
Declaration
public ScrollAxisBase(IScrollBar sb, ILineSizeHost scrollLinesHost)
Parameters
Type | Name | Description |
---|---|---|
IScrollBar | sb | The sb. |
ILineSizeHost | scrollLinesHost | The scroll lines host. |
Fields
distancesHost
Declaration
public IDistancesHost distancesHost
Field Value
Type |
---|
IDistancesHost |
Properties
Clip
Gets or sets the clipping region. Depending on the orientation of the axis, this is either the left and right or top and bottom values of the clipping rectangle in the parent control.
Declaration
public DoubleSpan Clip { get; set; }
Property Value
Type | Description |
---|---|
DoubleSpan | The clip. |
DefaultLineSize
Gets or sets the default size of lines.
Declaration
public abstract double DefaultLineSize { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default size of lines. |
Distances
Gets the distances collection which is used internally for mapping from a point position to a line index and vice versa.
Declaration
public IDistanceCounterCollection Distances { get; }
Property Value
Type | Description |
---|---|
IDistanceCounterCollection | The distances collection. |
FirstFooterLineIndex
Gets the index of the first footer line.
Declaration
public int FirstFooterLineIndex { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the first footer line. |
FooterExtent
Gets the footer extent. This is total height (or width) of the footer lines.
Declaration
public abstract double FooterExtent { get; }
Property Value
Type | Description |
---|---|
System.Double | The footer extent. |
FooterLineCount
Gets the footer line count.
Declaration
public virtual int FooterLineCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The footer line count. |
HeaderExtent
Gets the header extent. This is total height (or width) of the header lines.
Declaration
public abstract double HeaderExtent { get; }
Property Value
Type | Description |
---|---|
System.Double | The header extent. |
HeaderLineCount
Gets the header line count.
Declaration
public virtual int HeaderLineCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The header line count. |
IsFooterVisible
Gets a value indicating whether footer lines are visible.
Declaration
public bool IsFooterVisible { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsPixelScroll
Gets a value indicating whether this axis supports pixel scrolling.
Declaration
public abstract bool IsPixelScroll { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
LastBodyVisibleLine
Gets the last visible line.
Declaration
public VisibleLineInfo LastBodyVisibleLine { get; }
Property Value
Type | Description |
---|---|
VisibleLineInfo | The last visible line. |
LastBodyVisibleLineIndex
Gets the index of the last visible line.
Declaration
public int LastBodyVisibleLineIndex { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the last visible line. |
LineCount
Gets or sets the line count.
Declaration
public abstract int LineCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The line count. |
Name
Declaration
public string Name { get; set; }
Property Value
Type |
---|
System.String |
RenderSize
Gets or sets the size (either height or width) of the parent control.
Declaration
public double RenderSize { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The size of the the parent control. |
ScrollBar
Gets the scroll bar state.
Declaration
public IScrollBar ScrollBar { get; }
Property Value
Type | Description |
---|---|
IScrollBar | The scroll bar state. |
ScrollLineIndex
Gets or sets the index of the first visible Line in the Body region.
Declaration
public abstract int ScrollLineIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the scroll line. |
ScrollLinesHost
Gets the scroll lines host.
Declaration
public ILineSizeHost ScrollLinesHost { get; }
Property Value
Type | Description |
---|---|
ILineSizeHost | The scroll lines host. |
ScrollPageSize
Gets the size (either height or width) of the parent control excluding the area occupied by Header and Footer. This size is used for scrolling down or up one page.
Declaration
public double ScrollPageSize { get; }
Property Value
Type | Description |
---|---|
System.Double | The size of the the parent control. |
StartLineIndex
Gets or sets the index of the first line in a parent axis. This is used for shared or nested scroll axis (e.g. a nested grid with shared axis in a covered cell).
Declaration
public virtual int StartLineIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the first line.. |
ViewCorner
Gets the view corner which is the point after the last visible line of the body region.
Declaration
public double ViewCorner { get; }
Property Value
Type | Description |
---|---|
System.Double | The view corner. |
ViewSize
Gets the view size of the (either height or width) of the parent control. Normally the ViewSize is the same as RenderSize. Only if the parent control has more space then needed to display all lines, the ViewSize will be less. In such case the ViewSize is the total height for all lines.
Declaration
public abstract double ViewSize { get; }
Property Value
Type | Description |
---|---|
System.Double | The size of the view. |
Methods
add_Changed(ScrollChangedEventHandler)
Declaration
public void add_Changed(ScrollChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
ScrollChangedEventHandler | value |
AlignScrollLine()
Aligns the scroll line.
Declaration
public abstract void AlignScrollLine()
AnyVisibleLines(Int32, Int32)
Determines if any of the lines with the given absolut line index are visible.
Declaration
public bool AnyVisibleLines(int lineIndex1, int lineIndex2)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | lineIndex1 | |
System.Int32 | lineIndex2 |
Returns
Type |
---|
System.Boolean |
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
protected virtual void Dispose(bool isDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isDisposing |
FreezeVisibleLines()
Declaration
public void FreezeVisibleLines()
GetBorderRangeClipPoints(VisibleLineInfo, VisibleLineInfo)
Returns the clipping area for the specified visible lines. Only if IsClippedOrigin is true for first line or if IsClippedCorner is true for last line then the area will be clipped. Otherwise the whole area from 0 to RenderSize is returned.
Declaration
public DoubleSpan GetBorderRangeClipPoints(VisibleLineInfo firstLine, VisibleLineInfo lastLine)
Parameters
Type | Name | Description |
---|---|---|
VisibleLineInfo | firstLine | The first line. |
VisibleLineInfo | lastLine | The last line. |
Returns
Type |
---|
DoubleSpan |
GetClipPoints(ScrollAxisRegion)
Gets the clip points for a region.
Declaration
public DoubleSpan GetClipPoints(ScrollAxisRegion region)
Parameters
Type | Name | Description |
---|---|---|
ScrollAxisRegion | region | The region. |
Returns
Type |
---|
DoubleSpan |
GetLineNearCorner(Double, Double)
Gets the line near the given corner point. Use this method for hit-testing row or column lines for resizing cells.
Declaration
public VisibleLineInfo GetLineNearCorner(double point, double hitTestPrecision)
Parameters
Type | Name | Description |
---|---|---|
System.Double | point | The point. |
System.Double | hitTestPrecision | The hit test precision in points. |
Returns
Type |
---|
VisibleLineInfo |
GetLineNearCorner(Double, Double, CornerSide)
Gets the line near the given corner point. Use this method for hit-testing row or column lines for resizing cells.
Declaration
public VisibleLineInfo GetLineNearCorner(double point, double hitTestPrecision, CornerSide side)
Parameters
Type | Name | Description |
---|---|---|
System.Double | point | The point. |
System.Double | hitTestPrecision | The hit test precision in points. |
CornerSide | side | The hit test corner. |
Returns
Type |
---|
VisibleLineInfo |
GetLinesAndVisibility(Int32, Int32, Boolean, out Boolean, out Boolean, out VisibleLineInfo, out VisibleLineInfo)
Returns points for given absolut line indexes
Declaration
public void GetLinesAndVisibility(int firstIndex, int lastIndex, bool allowAdjust, out bool firstVisible, out bool lastVisible, out VisibleLineInfo firstLine, out VisibleLineInfo lastLine)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | firstIndex | The first index. |
System.Int32 | lastIndex | The last index. |
System.Boolean | allowAdjust | if set to |
System.Boolean | firstVisible | if set to |
System.Boolean | lastVisible | if set to |
VisibleLineInfo | firstLine | The first line or null if allowAdjust is false and line is not in viewable area. |
VisibleLineInfo | lastLine | The last line or null if allowAdjust is false and line is not in viewable area. |
GetLineSize(Int32)
Gets the size of the line.
Declaration
public double GetLineSize(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
Returns
Type |
---|
System.Double |
GetLineSize(Int32, out Int32)
Gets size from ScrollLinesHost or if the line is being resized then get temporary value previously set with SetLineResize(Int32, Double)
Declaration
public virtual double GetLineSize(int index, out int repeatSizeCount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
System.Int32 | repeatSizeCount | The number of subsequent values with same size. |
Returns
Type |
---|
System.Double |
GetNextPage(Int32)
Determines the line one page down from the given line.
Declaration
public int GetNextPage(int lineIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | lineIndex | The current line. |
Returns
Type | Description |
---|---|
System.Int32 | The line index of the line one page down |
GetNextScrollLineIndex(Int32)
Gets the index of the next scroll line.
Declaration
public abstract int GetNextScrollLineIndex(int lineIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | lineIndex | Index of the line. |
Returns
Type |
---|
System.Int32 |
GetOriginAndCornerOfBodyRegion(out Double, out Double)
Gets the origin and corner points of body region.
Declaration
public void GetOriginAndCornerOfBodyRegion(out double origin, out double corner)
Parameters
Type | Name | Description |
---|---|---|
System.Double | origin | The origin. |
System.Double | corner | The corner. |
GetPreviousPage(Int32)
Determines the line one page up from the given line.
Declaration
public int GetPreviousPage(int lineIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | lineIndex | The current line. |
Returns
Type | Description |
---|---|
System.Int32 | The line index of the line one page up |
GetPreviousScrollLineIndex(Int32)
Gets the index of the previous scroll line.
Declaration
public abstract int GetPreviousScrollLineIndex(int lineIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | lineIndex | Index of the line. |
Returns
Type |
---|
System.Int32 |
GetScrollLineIndex(out Int32, out Double)
Gets the index of the scroll line.
Declaration
public abstract void GetScrollLineIndex(out int scrollLindeIndex, out double scrollLineOffset)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | scrollLindeIndex | Index of the scroll linde. |
System.Double | scrollLineOffset | The scroll line offset. |
GetScrollLinesHostSize(Int32, out Int32)
Gets size from ScrollLinesHost or if the line is being resized then get temporary value previously set with SetLineResize(Int32, Double). If size is negative then DefaultLineSize is returned.
Declaration
public double GetScrollLinesHostSize(int index, out int repeatSizeCount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
System.Int32 | repeatSizeCount | The number of subsequent values with same size. |
Returns
Type |
---|
System.Double |
GetVisibleLineAtLineIndex(Int32)
Gets the visibles line that displays the line with the given absolut line index.
Declaration
public VisibleLineInfo GetVisibleLineAtLineIndex(int lineIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | lineIndex | Index of the line. |
Returns
Type |
---|
VisibleLineInfo |
GetVisibleLineAtLineIndex(Int32, Boolean)
Gets the visibles line that displays the line with the given absolut line index. If the line is outside the view and you specify allowCreateEmptyLineIfNotVisible then the method will create an empty line and initializes its LineIndex and LineSize.
Declaration
public VisibleLineInfo GetVisibleLineAtLineIndex(int lineIndex, bool allowCreateEmptyLineIfNotVisible)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | lineIndex | Index of the line. |
System.Boolean | allowCreateEmptyLineIfNotVisible | if set to |
Returns
Type |
---|
VisibleLineInfo |
GetVisibleLineAtPoint(Double, Boolean)
Gets the visibles line for a point in the display.
Declaration
public VisibleLineInfo GetVisibleLineAtPoint(double point, bool allowOutSideLines = false)
Parameters
Type | Name | Description |
---|---|---|
System.Double | point | The point. |
System.Boolean | allowOutSideLines |
Returns
Type |
---|
VisibleLineInfo |
GetVisibleLines()
Gets the visible lines collection
Declaration
public VisibleLinesCollection GetVisibleLines()
Returns
Type |
---|
VisibleLinesCollection |
GetVisibleLinesClipPoints(Int32, Int32)
Gets the visible lines clip points (clipped origin of first line and clipped corner of last line). If both lines are above or below viewable area an empty span is returned. If lines are both above and below viewable are then the range for all viewable lines is returned.
Declaration
public DoubleSpan GetVisibleLinesClipPoints(int firstIndex, int lastIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | firstIndex | The first index. |
System.Int32 | lastIndex | The last index. |
Returns
Type |
---|
DoubleSpan |
GetVisibleLinesRange(Int32)
Returns the first and last VisibleLine.LineIndex for area identified by section.
Declaration
public Int32Span GetVisibleLinesRange(int section)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | section | 0 - Header, 1 - Body, 2 - Footer |
Returns
Type |
---|
Int32Span |
GetVisibleSection(ScrollAxisRegion, out Int32, out Int32)
Return indexes for VisibleLinesCollection for area identified by section.
Declaration
public void GetVisibleSection(ScrollAxisRegion section, out int start, out int end)
Parameters
Type | Name | Description |
---|---|---|
ScrollAxisRegion | section | 0 - Header, 1 - Body, 2 - Footer |
System.Int32 | start | The start. |
System.Int32 | end | The end. |
GetVisibleSection(Int32, out Int32, out Int32)
Return indexes for VisibleLinesCollection for area identified by section.
Declaration
public void GetVisibleSection(int section, out int start, out int end)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | section | 0 - Header, 1 - Body, 2 - Footer |
System.Int32 | start | The start. |
System.Int32 | end | The end. |
IsLineVisible(Int32)
Determines if the line with the given absolut line index is visible.
Declaration
public bool IsLineVisible(int lineIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | lineIndex | Index of the line. |
Returns
Type |
---|
System.Boolean |
MarkDirty()
Force recalculation of visible lines and scrollbar properties next time GetVisibleLines is called.
Declaration
public void MarkDirty()
MouseWheel(Int32)
This method is called in response to a MouseWheel event.
Declaration
public abstract void MouseWheel(int delta)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | delta | The delta. |
OnLinesInserted(Int32, Int32)
Called when lines were inserted in ScrollLinesHost.
Declaration
protected virtual void OnLinesInserted(int insertAt, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | insertAt | Index of the first inserted line. |
System.Int32 | count | The count. |
OnLinesRemoved(Int32, Int32)
Called when lines were removed in ScrollLinesHost.
Declaration
protected virtual void OnLinesRemoved(int removeAt, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | removeAt | Index of the first removed line. |
System.Int32 | count | The count. |
RaiseChanged(ScrollChangedAction)
Raises the changed event.
Declaration
public void RaiseChanged(ScrollChangedAction action)
Parameters
Type | Name | Description |
---|---|---|
ScrollChangedAction | action |
RangeToPoints(ScrollAxisRegion, Int32, Int32, Boolean)
Returns the first and last point for the given lines in a region.
Declaration
public abstract DoubleSpan RangeToPoints(ScrollAxisRegion region, int first, int last, bool allowEstimatesForOutOfViewLines)
Parameters
Type | Name | Description |
---|---|---|
ScrollAxisRegion | region | The region. |
System.Int32 | first | The index of the first line. |
System.Int32 | last | The index of the last line. |
System.Boolean | allowEstimatesForOutOfViewLines | if set to |
Returns
Type |
---|
DoubleSpan |
RangeToRegionPoints(Int32, Int32, Boolean)
Returns an array with 3 ranges indicating the first and last point for the given lines in each region.
Declaration
public abstract DoubleSpan[] RangeToRegionPoints(int first, int last, bool allowEstimatesForOutOfViewLines)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | first | The index of the first line. |
System.Int32 | last | The index of the last line. |
System.Boolean | allowEstimatesForOutOfViewLines | if set to |
Returns
Type |
---|
DoubleSpan[] |
remove_Changed(ScrollChangedEventHandler)
Declaration
public void remove_Changed(ScrollChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
ScrollChangedEventHandler | value |
ResetLineResize()
Resets temporary value for line size after a resize operation
Declaration
public virtual void ResetLineResize()
ResetVisibleLines()
Resets the visible lines collection.
Declaration
public void ResetVisibleLines()
ScrollInView(Int32)
Scrolls the line into viewable area.
Declaration
public void ScrollInView(int lineIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | lineIndex | Index of the line. |
ScrollInView(Int32, Double)
Scrolls the line into viewable area.
Declaration
public virtual void ScrollInView(int lineIndex, double lineSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | lineIndex | Index of the line. |
System.Double | lineSize | Size of the line. |
ScrollToNextLine()
Scrolls to next line.
Declaration
public abstract void ScrollToNextLine()
ScrollToNextPage()
Scrolls to next page.
Declaration
public abstract void ScrollToNextPage()
ScrollToPreviousLine()
Scrolls to previous line.
Declaration
public abstract void ScrollToPreviousLine()
ScrollToPreviousPage()
Scrolls to previous page.
Declaration
public abstract void ScrollToPreviousPage()
SetFooterLineCount(Int32)
Sets the footer line count.
Declaration
protected abstract void SetFooterLineCount(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The value. |
SetHeaderLineCount(Int32)
Sets the header line count.
Declaration
protected abstract void SetHeaderLineCount(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The value. |
SetLineHiddenState(Int32, Int32, Boolean)
Sets the hidden state of the lines.
Declaration
public abstract void SetLineHiddenState(int from, int to, bool hide)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | from | From. |
System.Int32 | to | To. |
System.Boolean | hide | if set to |
SetLineResize(Int32, Double)
Set temporary value for a line size during a resize operation without commiting value to SrollLinesHost.
Declaration
public virtual void SetLineResize(int index, double size)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
System.Double | size | The size. |
SetLineSize(Int32, Int32, Double)
Sets the size of the lines.
Declaration
public abstract void SetLineSize(int from, int to, double size)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | from | From. |
System.Int32 | to | To. |
System.Double | size | The size. |
SetScrollLineIndex(Int32, Double)
Sets the index of the scroll line.
Declaration
public abstract void SetScrollLineIndex(int scrollLindeIndex, double scrollLineOffset)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | scrollLindeIndex | Index of the scroll linde. |
System.Double | scrollLineOffset | The scroll line offset. |
UnfreezeVisibleLines()
Declaration
public void UnfreezeVisibleLines()
UpdateScrollBar()
Updates the scroll bar.
Declaration
public abstract void UpdateScrollBar()
UpdateScrollBar(Boolean)
Declaration
public void UpdateScrollBar(bool ignorePropertyChange)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | ignorePropertyChange |
VisiblePointToLineIndex(Double)
Gets the visible line index for a point in the display.
Declaration
public int VisiblePointToLineIndex(double point)
Parameters
Type | Name | Description |
---|---|---|
System.Double | point | The point. |
Returns
Type |
---|
System.Int32 |
VisiblePointToLineIndex(Double, Boolean)
Gets the visible line index for a point in the display.
Declaration
public int VisiblePointToLineIndex(double point, bool allowOutsideLines)
Parameters
Type | Name | Description |
---|---|---|
System.Double | point | The point. |
System.Boolean | allowOutsideLines | Set this true if point can be below corner of last line. |
Returns
Type |
---|
System.Int32 |
Events
Changed
Occurs when a property was changed.
Declaration
public event ScrollChangedEventHandler Changed
Event Type
Type |
---|
ScrollChangedEventHandler |