smithery.ai

using-avalonia-collectionview

Provides CollectionView alternatives for AvaloniaUI using DataGridCollectionView and ReactiveUI. Use when filtering, sorting, or grouping collections in AvaloniaUI applications.

First seen Mar 21, 2026

Installation

$ npx skills add https://smithery.ai

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,121 B
  • docs SUMMARY.md 214 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 2 installs

SKILL.md

6.7 MVVM Pattern with CollectionView

⚠️ Important: AvaloniaUI does not support WPF's CollectionViewSource.

Project Structure

The templates folder contains a .NET 9 AvaloniaUI project example.

templates/
├── AvaloniaCollectionViewSample.Core/           ← Pure C# models and interfaces
│   ├── Member.cs
│   ├── IMemberCollectionService.cs
│   └── AvaloniaCollectionViewSample.Core.csproj
├── AvaloniaCollectionViewSample.ViewModels/     ← ViewModel (no Avalonia references)
│   ├── MainViewModel.cs
│   ├── GlobalUsings.cs
│   └── AvaloniaCollectionViewSample.ViewModels.csproj
├── AvaloniaCollectionViewSample.AvaloniaServices/ ← Avalonia Service Layer
│   ├── MemberCollectionService.cs
│   ├── GlobalUsings.cs
│   └── AvaloniaCollectionViewSample.AvaloniaServices.csproj
└── AvaloniaCollectionViewSample.App/            ← Avalonia Application
    ├── Views/
    │   ├── MainWindow.axaml
    │   └── MainWindow.axaml.cs
    ├── App.axaml
    ├── App.axaml.cs
    ├── Program.cs
    ├── GlobalUsings.cs
    └── AvaloniaCollectionViewSample.App.csproj

In AvaloniaUI, use the following approaches:

6.7.1 Using DataGridCollectionView (Recommended)

// NuGet: Avalonia.Controls.DataGrid
// Service Layer
namespace MyApp.Services;

using Avalonia.Controls;

public sealed class MemberCollectionService
{
    private ObservableCollection<Member> Source { get; } = [];

    // Returns DataGridCollectionView
    public IEnumerable CreateView(Predicate<Member>? filter = null)
    {
        var view = new DataGridCollectionView(Source);

        if (filter is not null)
        {
            view.Filter = item => filter((Member)item);
        }

        return view;
    }

    public void Add(Member item) => Source.Add(item);
    public void Remove(Member? item) { if (item is not null) Source.Remove(item); }
    public void Clear() => Source.Clear();
}

6.7.2 Using ReactiveUI (Alternative)

// NuGet: ReactiveUI.Avalonia
namespace MyApp.ViewModels;

using ReactiveUI;
using DynamicData;

public sealed class MainViewModel : ReactiveObject
{
    private readonly SourceList<Member> _sourceList = new();
    private readonly ReadOnlyObservableCollection<Member> _members;

    public ReadOnlyObservableCollection<Member> Members => _members;

    public MainViewModel()
    {
        _sourceList
            .Connect()
            .Filter(m => m.IsActive) // Filtering
            .Sort(SortExpressionComparer<Member>.Ascending(m => m.Name)) // Sorting
            .Bind(out _members)
            .Subscribe();
    }

    public void AddMember(Member member) => _sourceList.Add(member);
    public void RemoveMember(Member member) => _sourceList.Remove(member);
}