IVirtualizingPanel.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // Copyright (c) The Avalonia Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using Avalonia.Layout;
  4. namespace Avalonia.Controls
  5. {
  6. /// <summary>
  7. /// A panel that can be used to virtualize items.
  8. /// </summary>
  9. public interface IVirtualizingPanel : IPanel
  10. {
  11. /// <summary>
  12. /// Gets or sets the controller for the virtualizing panel.
  13. /// </summary>
  14. /// <remarks>
  15. /// A virtualizing controller is responsible for maintaining the controls in the virtualizing
  16. /// panel. This property will be set by the controller when virtualization is initialized.
  17. /// Note that this property may remain null if the panel is added to a control that does
  18. /// not act as a virtualizing controller.
  19. /// </remarks>
  20. IVirtualizingController Controller { get; set; }
  21. /// <summary>
  22. /// Gets a value indicating whether the panel is full.
  23. /// </summary>
  24. /// <remarks>
  25. /// This property should return false until enough children are added to fill the space
  26. /// passed into the last measure or arrange in the direction of scroll. It should be
  27. /// updated immediately after a child is added or removed.
  28. /// </remarks>
  29. bool IsFull { get; }
  30. /// <summary>
  31. /// Gets the number of items that can be removed while keeping the panel full.
  32. /// </summary>
  33. /// <remarks>
  34. /// This property should return the number of children that are completely out of the
  35. /// panel's current bounds in the direction of scroll. It should be updated after an
  36. /// arrange.
  37. /// </remarks>
  38. int OverflowCount { get; }
  39. /// <summary>
  40. /// Gets the direction of scroll.
  41. /// </summary>
  42. Orientation ScrollDirection { get; }
  43. /// <summary>
  44. /// Gets the average size of the materialized items in the direction of scroll.
  45. /// </summary>
  46. double AverageItemSize { get; }
  47. /// <summary>
  48. /// Gets or sets a size in pixels by which the content is overflowing the panel, in the
  49. /// direction of scroll.
  50. /// </summary>
  51. /// <remarks>
  52. /// This may be non-zero even when <see cref="OverflowCount"/> is zero if the last item
  53. /// overflows the panel bounds.
  54. /// </remarks>
  55. double PixelOverflow { get; }
  56. /// <summary>
  57. /// Gets or sets the current pixel offset of the items in the direction of scroll.
  58. /// </summary>
  59. double PixelOffset { get; set; }
  60. /// <summary>
  61. /// Gets or sets the current scroll offset in the cross axis.
  62. /// </summary>
  63. double CrossAxisOffset { get; set; }
  64. /// <summary>
  65. /// Invalidates the measure of the control and forces a call to
  66. /// <see cref="IVirtualizingController.UpdateControls"/> on the next measure.
  67. /// </summary>
  68. /// <remarks>
  69. /// The implementation for this method should call
  70. /// <see cref="ILayoutable.InvalidateMeasure"/> and also ensure that the next call to
  71. /// <see cref="ILayoutable.Measure(Size)"/> calls
  72. /// <see cref="IVirtualizingController.UpdateControls"/> on the next measure even if
  73. /// the available size hasn't changed.
  74. /// </remarks>
  75. void ForceInvalidateMeasure();
  76. }
  77. }