/* Based on VirtualizingWrapPanel created by S. Bäumlisberger licensed under MIT license. https://github.com/sbaeumlisberger/VirtualizingWrapPanel Copyright (C) S. Bäumlisberger All Rights Reserved. */ using System.Windows.Controls; // ReSharper disable once CheckNamespace namespace WPFluent.Controls; /// /// Virtualized . Based on . /// public class VirtualizingItemsControl : ItemsControl { /// /// Identifies the dependency property. /// public static readonly DependencyProperty CacheLengthUnitProperty = DependencyProperty.Register( nameof(CacheLengthUnit), typeof(VirtualizationCacheLengthUnit), typeof(VirtualizingItemsControl), new FrameworkPropertyMetadata(VirtualizationCacheLengthUnit.Page)); /// /// Initializes a new instance of the class. /// public VirtualizingItemsControl() { VirtualizingPanel.SetCacheLengthUnit(this, CacheLengthUnit); VirtualizingPanel.SetCacheLength(this, new VirtualizationCacheLength(1)); VirtualizingPanel.SetIsVirtualizingWhenGrouping(this, true); } /// /// Gets or sets the cache length unit. /// public VirtualizationCacheLengthUnit CacheLengthUnit { get => VirtualizingPanel.GetCacheLengthUnit(this); set { SetValue(CacheLengthUnitProperty, value); VirtualizingPanel.SetCacheLengthUnit(this, value); } } }