优化更新代码,添加界面功能并整合
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
|
||||
|
||||
|
||||
/* 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;
|
||||
|
||||
/// <summary>
|
||||
/// Virtualized <see cref="ItemsControl"/>. <para>Based on <see
|
||||
/// href="https://github.com/sbaeumlisberger/VirtualizingWrapPanel"/>.</para>
|
||||
/// </summary>
|
||||
public class VirtualizingItemsControl : ItemsControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="CacheLengthUnit"/> dependency property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty CacheLengthUnitProperty = DependencyProperty.Register(
|
||||
nameof(CacheLengthUnit),
|
||||
typeof(VirtualizationCacheLengthUnit),
|
||||
typeof(VirtualizingItemsControl),
|
||||
new FrameworkPropertyMetadata(VirtualizationCacheLengthUnit.Page));
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="VirtualizingItemsControl"/> class.
|
||||
/// </summary>
|
||||
public VirtualizingItemsControl()
|
||||
{
|
||||
VirtualizingPanel.SetCacheLengthUnit(this, CacheLengthUnit);
|
||||
VirtualizingPanel.SetCacheLength(this, new VirtualizationCacheLength(1));
|
||||
VirtualizingPanel.SetIsVirtualizingWhenGrouping(this, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the cache length unit.
|
||||
/// </summary>
|
||||
public VirtualizationCacheLengthUnit CacheLengthUnit
|
||||
{
|
||||
get => VirtualizingPanel.GetCacheLengthUnit(this);
|
||||
set
|
||||
{
|
||||
SetValue(CacheLengthUnitProperty, value);
|
||||
VirtualizingPanel.SetCacheLengthUnit(this, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user