Class ScrollViewer
- Namespace
- GHIElectronics.Endpoint.UI.Controls
- Assembly
- GHIElectronics.Endpoint.UI.dll
public class ScrollViewer : ContentControl
- Inheritance
-
ScrollViewer
- Inherited Members
Constructors
ScrollViewer()
public ScrollViewer()
Properties
ExtentHeight
public int ExtentHeight { get; }
Property Value
ExtentWidth
public int ExtentWidth { get; }
Property Value
HorizontalOffset
public int HorizontalOffset { get; set; }
Property Value
LineHeight
public int LineHeight { get; set; }
Property Value
LineWidth
public int LineWidth { get; set; }
Property Value
ScrollingStyle
public ScrollingStyle ScrollingStyle { get; set; }
Property Value
VerticalOffset
public int VerticalOffset { get; set; }
Property Value
Methods
ArrangeOverride(int, int)
ArrangeOverride allows for the customization of the final sizing and positioning of children.
protected override void ArrangeOverride(int arrangeWidth, int arrangeHeight)
Parameters
Remarks
UIElement authors should override this method, call Arrange on each visible child UIElement,
to size and position each child UIElement by passing a rectangle reserved for the child within parent space.
Note: It is required that a parent UIElement calls Arrange on each child or they won't be rendered.
Typical override follows a pattern roughly like this (pseudo-code):
protected override void ArrangeOverride(int arrangeWidth, int arrangeHeight)
{
foreach (UIElement child in VisualChildren)
{
child.Arrange(new Rect(childX, childY, childWidth, childHeight);
}
}</code></pre></example>
LineDown()
public void LineDown()
LineLeft()
public void LineLeft()
LineRight()
public void LineRight()
LineUp()
public void LineUp()
MeasureOverride(int, int, out int, out int)
Measurement override. Implement your size-to-content logic here.
protected override void MeasureOverride(int availableWidth, int availableHeight, out int desiredWidth, out int desiredHeight)
Parameters
availableWidthintAvailable size that parent can give to the child. May be MaxValue(when parent wants to measure to content). This is soft constraint. Child can return bigger size to indicate that it wants bigger space and hope that parent can throw in scrolling...
availableHeightintdesiredWidthintdesiredHeightint
Remarks
MeasureOverride is designed to be the main customizability point for size control of layout. UIElement authors should override this method, call Measure on each child UIElement, and compute their desired size based upon the measurement of the children. The return value should be the desired size.
Note: It is required that a parent UIElement calls Measure on each child or they won't be sized/arranged. Typical override follows a pattern roughly like this (pseudo-code):protected override void MeasureOverride(int avialableWidth, int availableHeight, out int desiredWidth, out int desiredHeight)
{
foreach (UIElement child in VisualChildren)
{
child.Measure(availableSize);
availableSize.Deflate(child.DesiredSize);
_cache.StoreInfoAboutChild(child);
}
Size desired = CalculateBasedOnCache(_cache);
return desired;
}</code></pre></example>
The key aspects of this snippet are:
- You must call Measure on each child UIElement
- It is common to cache measurement information between the MeasureOverride and ArrangeOverride method calls
- Calling base.MeasureOverride is not required.
- Calls to Measure on children are passing either the same availableSize as the parent, or a subset of the area depending
on the type of layout the parent will perform (for example, it would be valid to remove the area
for some border or padding).
OnButtonDown(ButtonEventArgs)
An event reporting a button was pressed.
protected override void OnButtonDown(ButtonEventArgs e)
Parameters
PageDown()
public void PageDown()
PageLeft()
public void PageLeft()
PageRight()
public void PageRight()
PageUp()
public void PageUp()
Events
ScrollChanged
public event ScrollChangedEventHandler ScrollChanged