Browse Source

Tweaked documentation and TestScrollable.

pull/366/head
Steven Kirk 11 years ago
parent
commit
0e3768d2b4
  1. 16
      samples/XamlTestApplicationPcl/TestScrollable.cs
  2. 9
      src/Perspex.Controls/Primitives/IScrollable.cs

16
samples/XamlTestApplicationPcl/TestScrollable.cs

@ -9,17 +9,12 @@ namespace XamlTestApplication
public class TestScrollable : Control, IScrollable
{
private int itemCount = 100;
private Action _invalidateScroll;
private Size _extent;
private Vector _offset;
private Size _viewport;
private Size _lineSize;
public Action InvalidateScroll
{
get { return _invalidateScroll; }
set { _invalidateScroll = value; }
}
public Action InvalidateScroll { get; set; }
Size IScrollable.Extent
{
@ -28,10 +23,7 @@ namespace XamlTestApplication
Vector IScrollable.Offset
{
get
{
return _offset;
}
get { return _offset; }
set
{
@ -64,8 +56,8 @@ namespace XamlTestApplication
protected override Size ArrangeOverride(Size finalSize)
{
_viewport = new Size(finalSize.Width, finalSize.Height / _lineSize.Height);
_extent = new Size(_lineSize.Width, itemCount);
InvalidateScroll();
_extent = new Size(_lineSize.Width, itemCount + 1);
InvalidateScroll?.Invoke();
return finalSize;
}

9
src/Perspex.Controls/Primitives/IScrollable.cs

@ -12,12 +12,17 @@ namespace Perspex.Controls.Primitives
public interface IScrollable
{
/// <summary>
/// Gets or sets the invalidation method which notifies the attached
/// <see cref="ScrollViewer"/> of a change in <see cref="Extent"/> or <see cref="Offset"/>.
/// Gets or sets the scroll invalidation method.
/// </summary>
/// <remarks>
/// <para>
/// This method notifies the attached <see cref="ScrollViewer"/> of a change in
/// the <see cref="Extent"/>, <see cref="Offset"/> or <see cref="Viewport"/> properties.
/// </para>
/// <para>
/// This property is set by the parent <see cref="ScrollViewer"/> when the
/// <see cref="IScrollable"/> is placed inside it.
/// </para>
/// </remarks>
Action InvalidateScroll { get; set; }

Loading…
Cancel
Save