CompositionCollectionView 0.2.0
dotnet add package CompositionCollectionView --version 0.2.0
NuGet\Install-Package CompositionCollectionView -Version 0.2.0
<PackageReference Include="CompositionCollectionView" Version="0.2.0" />
<PackageVersion Include="CompositionCollectionView" Version="0.2.0" />
<PackageReference Include="CompositionCollectionView" />
paket add CompositionCollectionView --version 0.2.0
#r "nuget: CompositionCollectionView, 0.2.0"
#:package CompositionCollectionView@0.2.0
#addin nuget:?package=CompositionCollectionView&version=0.2.0
#tool nuget:?package=CompositionCollectionView&version=0.2.0
CompositionCollectionView
A composition-driven collection view control for UWP and WinUI 3 / Windows App SDK, with fully customizable layouts and behaviors powered by Windows.UI.Composition.
Features
- Composition-powered animations — all element positioning, scaling, rotation, and opacity are driven by composition expression animations for smooth 60fps performance
- Custom layouts — extend
CompositionCollectionLayout<TId, TItem>to define how elements are positioned, scaled, and rotated - Animated layout transitions — smoothly animate between different layouts with
TransitionTo() - Behaviors — attach reusable behaviors like
InteractionTrackerBehaviorfor gesture-driven interactions - Interaction tracker gestures — define composable touch/pointer gestures with visual previews
- Multi-platform — ships as a single NuGet package targeting both UWP (
uap10.0.19041) and WinUI 3 (net9.0-windows10.0.19041.0)
Quick Start
<labs:CompositionCollectionView x:Name="collectionView"
Width="600" Height="200" />
// Define a simple horizontal layout
public class HorizontalLayout : CompositionCollectionLayout<uint, MyItem>
{
public HorizontalLayout(Func<uint, FrameworkElement> factory) : base(factory) { }
public override Vector3Node GetElementPositionNode(ElementReference<uint, MyItem> element)
=> ExpressionFunctions.Vector3(element.Id * 120, 0, 0);
}
// Create and use the layout
var layout = new HorizontalLayout(id => new MyItemControl());
collectionView.SetLayout(layout);
await collectionView.UpdateSource(myItems);
Solution Structure
CompositionCollectionView/
├── src/CompositionCollectionView/ # Control library (UWP + WinUI 3)
├── samples/
│ ├── CompositionCollectionView.Sample.Uwp/ # UWP sample app
│ └── CompositionCollectionView.Sample.WinUI3/ # WinUI 3 sample app
Building
Build with Visual Studio 2022+ or MSBuild:
msbuild CompositionCollectionView.sln /p:Platform=x64
Architecture
CompositionCollectionLayout
The core abstract class you extend to define layouts. Override these methods:
| Method | Purpose |
|---|---|
GetElementPositionNode() |
Return an expression node for element position |
GetElementScaleNode() |
Return an expression node for element scale |
GetElementOpacityNode() |
Return an expression node for element opacity |
GetElementOrientationNode() |
Return an expression node for element orientation |
GetElementTransitionEasingFunction() |
Define transition animation easing |
Behaviors
Attach CompositionCollectionLayoutBehavior<TId, TItem> instances to layouts for reusable functionality:
InteractionTrackerBehavior— wrapsVisualInteractionSource+InteractionTrackerfor gesture handlingElementInteractionTrackerBehavior— per-element interaction trackersInteractionTrackerGesture— composable gesture definitions with visual previews
ExpressionsFork
An internal fork of the Windows Community Toolkit's expression animation helpers, with added Evaluate() method support.
CompositionExpressions (standalone expression-DSL packages)
The typed expression-animation DSL (ExpressionsFork — ScalarNode, Matrix4x4Node, ExpressionFunctions, .Evaluate(), plus the animatable-node wrappers) is also published on its own, so you can compose CompositionObject expression animations without taking a dependency on the collection-view control.
Which package you need depends on two independent axes — the target-framework era and the composition surface your app renders on:
System Windows.UI.Composition |
Lifted Microsoft.UI.Composition |
|
|---|---|---|
UWP (uap10.0) |
arcadiog.CompositionExpressions (uap asset) |
— |
.NET 5+ (net10.0-windows) |
arcadiog.CompositionExpressions.SystemComp |
arcadiog.CompositionExpressions (net asset) |
arcadiog.CompositionExpressions— the mainstream package. Ships a UWP asset (system composition, for UWP apps) and anet10.0-windowsasset that binds to the liftedMicrosoft.UI.Compositionand depends on the Windows App SDK. Use it from WinUI 3 / Windows App SDK apps.arcadiog.CompositionExpressions.SystemComp— for .NET 5+ hosts that render on the system compositor (Windows.UI.Compositionon aDesktopWindowTarget), e.g. a transparent per-pixel-alpha window created outside the XAML/WinUI stack. This is the one asset the mainstream package can't provide: its UWP asset tripsNETSDK1149when consumed from .NET 5+, and its liftednet10.0-windowsasset is the wrong composition surface and drags in the Windows App SDK.It compiles the same DSL source, but with a distinct assembly name (
CompositionExpressions.SystemComp) so a single app can reference both flavors at once — e.g. lifted composition for its main WinUI window and system composition for a headless/transparent companion window — without aCompositionExpressions.dlloutput collision.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows10.0.19041 is compatible. |
| Universal Windows Platform | uap10.0.19041 is compatible. |
-
net10.0-windows10.0.19041
- arcadiog.CompositionExpressions (>= 0.2.0)
- Microsoft.WindowsAppSDK (>= 1.7.250401001)
-
UAP 10.0.19041
- arcadiog.CompositionExpressions (>= 0.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.