[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CVA1DGZMA042QY3Z71B98M":3,"skill-same:01M7CVA1DGZMA042QY3Z71B98M":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":13,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7CVA1DGZMA042QY3Z71B98M","maui-collectionview",null,"Guidance for implementing CollectionView in .NET MAUI apps — data display, layouts (list & grid), selection, grouping, scrolling, empty views, templates, incremental loading, swipe actions, and pull-to-refresh. USE FOR: \"CollectionView\", \"list view\", \"grid layout\", \"data template\", \"item template\", \"grouping\", \"pull to refresh\", \"incremental loading\", \"swipe actions\", \"empty view\", \"selection mode\", \"scroll to item\", displaying scrollable data, replacing ListView. DO NOT USE FOR: simple static layouts without scrollable data (use Grid or StackLayout), map pin lists (use Microsoft.Maui.Controls.Maps), table-based data entry forms, non-MAUI list controls, CarouselView or BindableLayout questions, platform-specific handler or renderer customization, diagnosing CollectionView bugs in the MAUI framework itself, or general MVVM\u002Fbinding questions that merely happen to mention a list (use maui-data-binding).","deadmade\u002Fdead-agent-skills","deadmade","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F130925709?v=4","01M7CTQ65AGYR4J9K9TX0YR9V3","01M7CTQ66B4VMJFEDZP4EKKE6K",0,"MIT","https:\u002F\u002Fgithub.com\u002Fdeadmade\u002Fdead-agent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fopt-in\u002Fimplementation\u002Fcsharp-skills\u002Flibrary\u002Fmaui-collectionview\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: maui-collectionview\ndescription: >\n  Guidance for implementing CollectionView in .NET MAUI apps — data display,\n  layouts (list & grid), selection, grouping, scrolling, empty views, templates,\n  incremental loading, swipe actions, and pull-to-refresh.\n  USE FOR: \"CollectionView\", \"list view\", \"grid layout\", \"data template\",\n  \"item template\", \"grouping\", \"pull to refresh\", \"incremental loading\",\n  \"swipe actions\", \"empty view\", \"selection mode\", \"scroll to item\",\n  displaying scrollable data, replacing ListView.\n  DO NOT USE FOR: simple static layouts without scrollable data (use Grid or\n  StackLayout), map pin lists (use Microsoft.Maui.Controls.Maps), table-based\n  data entry forms, non-MAUI list controls, CarouselView or BindableLayout\n  questions, platform-specific handler or renderer customization, diagnosing\n  CollectionView bugs in the MAUI framework itself, or general MVVM\u002Fbinding\n  questions that merely happen to mention a list (use maui-data-binding).\nlicense: MIT\n---\n\n# CollectionView — .NET MAUI\n\n`CollectionView` is the primary control for displaying scrollable lists and grids of data in .NET MAUI. It replaces `ListView` with better performance, flexible layouts, and no `ViewCell` requirement.\n\n## When to Use\n\n- Displaying a scrollable list or grid of data items\n- Binding a collection of objects to a templated item layout\n- Adding selection (single or multiple), grouping, or pull-to-refresh\n- Implementing infinite scroll \u002F incremental loading\n- Showing swipe actions on list items\n- Displaying an empty state when no data is available\n\n## When Not to Use\n\n- Static layouts with a fixed number of items — use `Grid` or `StackLayout` directly\n- Map pin lists — use the `Microsoft.Maui.Controls.Maps` NuGet package\n- Table-based data entry forms — use standard form controls\n- Simple text-only lists with no interaction — consider `BindableLayout` on a `StackLayout`\n\n## Scope Control — Answer Only What Was Asked\n\nThis skill is a **reference you consult**, not a checklist you apply. Most requests\nneed one or two sections from it. Pulling in the rest makes the answer worse.\n\n**Stop conditions — do NOT act when:**\n\n- **The user asked a narrow question.** Answer that question only. Do not append\n  grouping, swipe actions, empty views, snap points, or performance tips that\n  were not asked about.\n- **The user's existing code already works.** Do not rewrite working markup to\n  match the examples here. Point out a concrete defect; if there is none, say so\n  and answer the question that was asked.\n- **The change is stylistic.** Renaming, reordering attributes, or restructuring\n  a template that already behaves correctly is churn, not a fix.\n- **The control isn't `CollectionView`.** `CarouselView`, `BindableLayout`, and\n  `ListView`-in-maintenance code have different rules. Do not rewrite `ListView`\n  code the user did not ask about — but if they ask *which* control to use, or are\n  migrating from Xamarin.Forms, recommend `CollectionView` (see\n  [Migrating from ListView](#migrating-from-listview)).\n- **The problem is really a binding, DI, or navigation problem** that happens to\n  involve a list — defer to `maui-data-binding`, `maui-dependency-injection`, or\n  `maui-shell-navigation`.\n\n**The API sections below are a reference, not a checklist — offer them only when\nrelevant.** Four rules are non-negotiable, because violating them produces code that\ndoes not work or silently loses compile-time checking:\n\n1. Never use `ViewCell` as a `DataTemplate` root in `CollectionView`.\n2. Use `ObservableCollection\u003CT>` when the list mutates after first render.\n3. Mutate the bound collection on the UI thread.\n4. Set `x:DataType` on every `DataTemplate` (and on the page root) for compiled bindings.\n\nEverything else — sizing strategy, snap points, header\u002Ffooter, empty views — is\noptional and should be offered only when it addresses the user's actual problem.\n\n## Inputs\n\n- A data source (typically `ObservableCollection\u003CT>`) bound to `ItemsSource`\n- A `DataTemplate` defining how each item renders\n- Optional: layout configuration, selection mode, grouping model, empty view\n\n## Basic Setup\n\nA complete, copy-pasteable page. Two things are load-bearing: the `xmlns:models`\ndeclaration that every `x:DataType=\"models:Item\"` in this skill assumes, and the\n**root `x:DataType`** — without it the outer `ItemsSource` binding is not compiled:\n\n```xml\n\u003CContentPage xmlns=\"http:\u002F\u002Fschemas.microsoft.com\u002Fdotnet\u002F2021\u002Fmaui\"\n             xmlns:x=\"http:\u002F\u002Fschemas.microsoft.com\u002Fwinfx\u002F2009\u002Fxaml\"\n             xmlns:models=\"clr-namespace:MyApp.Models\"\n             xmlns:vm=\"clr-namespace:MyApp.ViewModels\"\n             x:DataType=\"vm:ItemsViewModel\"\n             x:Class=\"MyApp.ItemsPage\">\n    \u003CContentPage.BindingContext>\n        \u003Cvm:ItemsViewModel \u002F>\n    \u003C\u002FContentPage.BindingContext>\n    \u003CCollectionView ItemsSource=\"{Binding Items}\">\n        \u003CCollectionView.ItemTemplate>\n            \u003CDataTemplate x:DataType=\"models:Item\">\n                \u003CHorizontalStackLayout Padding=\"8\" Spacing=\"8\">\n                    \u003CImage Source=\"{Binding Icon}\" WidthRequest=\"40\" HeightRequest=\"40\" \u002F>\n                    \u003CLabel Text=\"{Binding Name}\" VerticalOptions=\"Center\" \u002F>\n                \u003C\u002FHorizontalStackLayout>\n            \u003C\u002FDataTemplate>\n        \u003C\u002FCollectionView.ItemTemplate>\n    \u003C\u002FCollectionView>\n\u003C\u002FContentPage>\n```\n\nLater snippets show only the `CollectionView` element. When you hand a snippet to a\nuser, include the matching `xmlns:` declaration for any prefix it uses, or the XAML\nwill not compile.\n\nThe inline `\u003CContentPage.BindingContext>` above keeps the example self-contained. In\nan app that uses dependency injection, register the ViewModel instead and assign it\nthrough constructor injection (`BindingContext = vm;`) — see the\n**maui-dependency-injection** skill.\n\n**Key rules:**\n\n- Bind `ItemsSource` to an `ObservableCollection\u003CT>` so the UI updates on add\u002Fremove.\n- Each item template root must be a `Layout` or `View` — **never use `ViewCell`**.\n- Always set `x:DataType` on `DataTemplate` for compiled bindings.\n\n## Layouts\n\nSet `ItemsLayout` to control arrangement. Default is `VerticalList`.\n\n| Layout | XAML value |\n|---|---|\n| Vertical list | `VerticalList` (default) |\n| Horizontal list | `HorizontalList` |\n| Vertical grid | `GridItemsLayout` with `Orientation=\"Vertical\"` |\n| Horizontal grid | `GridItemsLayout` with `Orientation=\"Horizontal\"` |\n\n### Grid Layout\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding Items}\">\n    \u003CCollectionView.ItemsLayout>\n        \u003CGridItemsLayout Orientation=\"Vertical\"\n                         Span=\"2\"\n                         VerticalItemSpacing=\"8\"\n                         HorizontalItemSpacing=\"8\" \u002F>\n    \u003C\u002FCollectionView.ItemsLayout>\n    \u003CCollectionView.ItemTemplate>\n        \u003CDataTemplate x:DataType=\"models:Item\">\n            \u003CBorder Padding=\"8\" StrokeThickness=\"0\">\n                \u003CVerticalStackLayout>\n                    \u003CImage Source=\"{Binding Image}\" HeightRequest=\"120\" Aspect=\"AspectFill\" \u002F>\n                    \u003CLabel Text=\"{Binding Name}\" FontAttributes=\"Bold\" \u002F>\n                \u003C\u002FVerticalStackLayout>\n            \u003C\u002FBorder>\n        \u003C\u002FDataTemplate>\n    \u003C\u002FCollectionView.ItemTemplate>\n\u003C\u002FCollectionView>\n```\n\n### Horizontal List\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding Items}\"\n                ItemsLayout=\"HorizontalList\" \u002F>\n```\n\n## Selection\n\n### Selection Mode\n\n| Mode | Property to bind | Binding mode |\n|---|---|---|\n| `None` | — | — |\n| `Single` | `SelectedItem` | `TwoWay` |\n| `Multiple` | `SelectedItems` | `OneWay` |\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding Items}\"\n                SelectionMode=\"Single\"\n                SelectedItem=\"{Binding CurrentItem, Mode=TwoWay}\"\n                SelectionChangedCommand=\"{Binding ItemSelectedCommand}\" \u002F>\n```\n\nFor `Multiple` selection, bind `SelectedItems` (type `IList\u003Cobject>`):\n\n```xml\n\u003CCollectionView SelectionMode=\"Multiple\"\n                SelectedItems=\"{Binding ChosenItems, Mode=OneWay}\" \u002F>\n```\n\n### Selected Visual State\n\nHighlight selected items using `VisualStateManager`:\n\n```xml\n\u003CCollectionView.ItemTemplate>\n    \u003CDataTemplate x:DataType=\"models:Item\">\n        \u003CGrid Padding=\"8\">\n            \u003CVisualStateManager.VisualStateGroups>\n                \u003CVisualStateGroup Name=\"CommonStates\">\n                    \u003CVisualState Name=\"Normal\">\n                        \u003CVisualState.Setters>\n                            \u003CSetter Property=\"BackgroundColor\" Value=\"Transparent\" \u002F>\n                        \u003C\u002FVisualState.Setters>\n                    \u003C\u002FVisualState>\n                    \u003CVisualState Name=\"Selected\">\n                        \u003CVisualState.Setters>\n                            \u003CSetter Property=\"BackgroundColor\"\n                                    Value=\"{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource PrimaryDark}}\" \u002F>\n                        \u003C\u002FVisualState.Setters>\n                    \u003C\u002FVisualState>\n                \u003C\u002FVisualStateGroup>\n            \u003C\u002FVisualStateManager.VisualStateGroups>\n            \u003CLabel Text=\"{Binding Name}\" \u002F>\n        \u003C\u002FGrid>\n    \u003C\u002FDataTemplate>\n\u003C\u002FCollectionView.ItemTemplate>\n```\n\n## Grouping\n\n1. Create a group class inheriting from `List\u003CT>`:\n\n```csharp\npublic class AnimalGroup : List\u003CAnimal>\n{\n    public string Name { get; }\n    public AnimalGroup(string name, List\u003CAnimal> animals) : base(animals)\n    {\n        Name = name;\n    }\n}\n```\n\n2. Bind to `ObservableCollection\u003CAnimalGroup>` and set `IsGrouped=\"True\"`:\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding AnimalGroups}\"\n                IsGrouped=\"True\">\n    \u003CCollectionView.GroupHeaderTemplate>\n        \u003CDataTemplate x:DataType=\"models:AnimalGroup\">\n            \u003CLabel Text=\"{Binding Name}\"\n                   FontAttributes=\"Bold\"\n                   BackgroundColor=\"{StaticResource Gray100}\"\n                   Padding=\"8\" \u002F>\n        \u003C\u002FDataTemplate>\n    \u003C\u002FCollectionView.GroupHeaderTemplate>\n    \u003CCollectionView.ItemTemplate>\n        \u003CDataTemplate x:DataType=\"models:Animal\">\n            \u003CLabel Text=\"{Binding Name}\" Padding=\"16,4\" \u002F>\n        \u003C\u002FDataTemplate>\n    \u003C\u002FCollectionView.ItemTemplate>\n\u003C\u002FCollectionView>\n```\n\n## Pull-to-Refresh\n\nWrap `CollectionView` in a `RefreshView`. Set `IsRefreshing` back to `false` when done:\n\n```xml\n\u003CRefreshView IsRefreshing=\"{Binding IsRefreshing}\"\n             Command=\"{Binding RefreshCommand}\">\n    \u003CCollectionView ItemsSource=\"{Binding Items}\" \u002F>\n\u003C\u002FRefreshView>\n```\n\n## Incremental Loading (Infinite Scroll)\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding Items}\"\n                RemainingItemsThreshold=\"5\"\n                RemainingItemsThresholdReachedCommand=\"{Binding LoadMoreCommand}\" \u002F>\n```\n\n> ⚠️ **Do NOT use with non-virtualizing layouts.** `LinearItemsLayout` and `GridItemsLayout` support virtualization. Using `BindableLayout` on a `StackLayout` as an alternative to `CollectionView` has no virtualization, which triggers infinite threshold-reached events.\n\n## SwipeView — Binding from Inside DataTemplate\n\nCommands inside a `DataTemplate` can't directly reach your ViewModel. Use `RelativeSource AncestorType`:\n\n```xml\n\u003CCollectionView.ItemTemplate>\n    \u003CDataTemplate x:DataType=\"models:Item\">\n        \u003CSwipeView>\n            \u003CSwipeView.RightItems>\n                \u003CSwipeItems>\n                    \u003CSwipeItem Text=\"Delete\"\n                               BackgroundColor=\"Red\"\n                               Command=\"{Binding BindingContext.DeleteCommand, Source={RelativeSource AncestorType={x:Type ContentPage}}}\"\n                               CommandParameter=\"{Binding}\" \u002F>\n                \u003C\u002FSwipeItems>\n            \u003C\u002FSwipeView.RightItems>\n            \u003CGrid Padding=\"8\">\n                \u003CLabel Text=\"{Binding Name}\" \u002F>\n            \u003C\u002FGrid>\n        \u003C\u002FSwipeView>\n    \u003C\u002FDataTemplate>\n\u003C\u002FCollectionView.ItemTemplate>\n```\n\n## EmptyView\n\nShown when `ItemsSource` is empty or null.\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding SearchResults}\"\n                EmptyView=\"No items found.\" \u002F>\n```\n\nFor a custom empty view, wrap in `ContentView`:\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding SearchResults}\">\n    \u003CCollectionView.EmptyView>\n        \u003CContentView>\n            \u003CVerticalStackLayout HorizontalOptions=\"Center\" VerticalOptions=\"Center\">\n                \u003CImage Source=\"empty_state.png\" WidthRequest=\"120\" \u002F>\n                \u003CLabel Text=\"Nothing here yet\" HorizontalTextAlignment=\"Center\" \u002F>\n            \u003C\u002FVerticalStackLayout>\n        \u003C\u002FContentView>\n    \u003C\u002FCollectionView.EmptyView>\n\u003C\u002FCollectionView>\n```\n\n## Headers and Footers\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding Items}\">\n    \u003CCollectionView.Header>\n        \u003CLabel Text=\"Header\" FontAttributes=\"Bold\" Padding=\"8\" \u002F>\n    \u003C\u002FCollectionView.Header>\n    \u003CCollectionView.Footer>\n        \u003CLabel Text=\"Footer\" FontAttributes=\"Italic\" Padding=\"8\" \u002F>\n    \u003C\u002FCollectionView.Footer>\n\u003C\u002FCollectionView>\n```\n\nUse `HeaderTemplate` \u002F `FooterTemplate` when headers or footers are data-bound.\n\n## Scrolling\n\n### ScrollTo\n\nProgrammatically scroll by index or item:\n\n```csharp\n\u002F\u002F Scroll to index\ncollectionView.ScrollTo(index: 10, position: ScrollToPosition.Center, animate: true);\n\n\u002F\u002F Scroll to item\ncollectionView.ScrollTo(item: myItem, position: ScrollToPosition.MakeVisible, animate: true);\n```\n\n| ScrollToPosition | Behavior |\n|---|---|\n| `MakeVisible` | Scrolls just enough to make the item visible |\n| `Start` | Scrolls item to the start of the viewport |\n| `Center` | Scrolls item to the center of the viewport |\n| `End` | Scrolls item to the end of the viewport |\n\n### Snap Points\n\n```xml\n\u003CCollectionView.ItemsLayout>\n    \u003CLinearItemsLayout Orientation=\"Horizontal\"\n                       SnapPointsType=\"MandatorySingle\"\n                       SnapPointsAlignment=\"Center\" \u002F>\n\u003C\u002FCollectionView.ItemsLayout>\n```\n\n- `SnapPointsType`: `None`, `Mandatory`, `MandatorySingle`\n- `SnapPointsAlignment`: `Start`, `Center`, `End`\n\n## Migrating from ListView\n\n`ListView` still compiles, but **as of .NET 10** it is marked `[Obsolete]`\n(\"*ListView is deprecated. Please use CollectionView instead.*\"). It is **not**\nobsolete on .NET 9 and earlier, so check the project's target framework before\ndescribing it as deprecated. **If the user asks\nwhich control to use, or is migrating from Xamarin.Forms, recommend\n`CollectionView`** — it is faster, needs no `ViewCell`, and supports flexible\nlayouts. What to avoid is silently rewriting `ListView` code the user did not ask\nyou to touch.\n\n| `ListView` | `CollectionView` equivalent |\n|---|---|\n| `ViewCell` template root | Any `View`\u002F`Layout` root — **`ViewCell` is not supported** |\n| `ItemSelected` event | `SelectionChanged` event, or `SelectionChangedCommand` |\n| `ItemTapped` event | A `TapGestureRecognizer` in the item template — `SelectionChanged` only fires when the selection *changes*, so it will not re-fire on tapping the already-selected item |\n| `IsPullToRefreshEnabled` + `Refreshing` | Wrap the `CollectionView` in a `RefreshView` |\n| `IsGroupingEnabled` | `IsGrouped` |\n| `HasUnevenRows=\"True\"` | Default `ItemSizingStrategy=\"MeasureAllItems\"` |\n| `RowHeight` (fixed height) | Set the height in the item template. `MeasureFirstItem` only reuses the first item's measured size — it is not an explicit row height |\n| `SeparatorVisibility` \u002F `SeparatorColor` | **No equivalent** — draw a `BoxView`\u002F`Border` in the item template |\n\nThe missing separator API is the most common migration surprise: `CollectionView`\nhas no built-in separators, so add one to the template yourself.\n\n## Performance Tips\n\nApply these only when the user reports a performance problem or explicitly asks\nabout performance — they are not a default checklist.\n\n- **Use `MeasureFirstItem`** for uniform item sizes — significantly faster than the default\n  `MeasureAllItems`, which measures every item individually. Set it on the `CollectionView`\n  itself (it is declared on `StructuredItemsView`), **not** on `LinearItemsLayout` \u002F\n  `GridItemsLayout`:\n  ```xml\n  \u003CCollectionView ItemsSource=\"{Binding Items}\"\n                  ItemSizingStrategy=\"MeasureFirstItem\">\n      \u003CCollectionView.ItemTemplate>\n          \u003CDataTemplate x:DataType=\"models:Item\">\n              \u003CGrid Padding=\"8\" ColumnDefinitions=\"44,*\" ColumnSpacing=\"8\">\n                  \u003CImage WidthRequest=\"44\" HeightRequest=\"44\" \u002F>\n                  \u003CLabel Grid.Column=\"1\" Text=\"{Binding Name}\" VerticalOptions=\"Center\" \u002F>\n              \u003C\u002FGrid>\n          \u003C\u002FDataTemplate>\n      \u003C\u002FCollectionView.ItemTemplate>\n  \u003C\u002FCollectionView>\n  ```\n  **When `MeasureFirstItem` is the wrong choice** — keep the default `MeasureAllItems` if:\n  - Items vary in height (wrapping text, optional rows, images of differing aspect) — the\n    first item's size is applied to all, so the rest are clipped or stretched.\n  - A `DataTemplateSelector` returns different templates — the first item won't represent\n    the others.\n  - The first item is atypical (a header-like or \"featured\" row) — every item inherits its\n    size. Fixing this by reordering data is a smell; use `MeasureAllItems` instead.\n  - Item size depends on runtime data that isn't loaded yet when the first item is measured.\n- **Use `ObservableCollection\u003CT>` when the list mutates after first render.** It implements\n  `INotifyCollectionChanged`, so in-place `Add`\u002F`Remove`\u002F`Insert` update the UI incrementally.\n  A `List\u003CT>` is fine for a list that never changes after it is bound. Note that *replacing*\n  `ItemsSource` re-renders everything regardless of the collection type — so mutate the bound\n  collection in place rather than reassigning it.\n- **Update collections on the UI thread** — `MainThread.BeginInvokeOnMainThread(() => Items.Add(item))`.\n\n## Common Pitfalls\n\n| Issue | Fix |\n|---|---|\n| UI doesn't update when items change | Use `ObservableCollection\u003CT>`, not `List\u003CT>`. |\n| App crashes or blank items | **Never use `ViewCell`** — use `Grid`, `StackLayout`, or any `View` as template root. |\n| Items disappear or layout breaks | Always update `ItemsSource` and the collection on the **UI thread** (`MainThread.BeginInvokeOnMainThread`). |\n| Incremental loading fires endlessly | Don't use `StackLayout` as layout; use `LinearItemsLayout` or `GridItemsLayout`. |\n| EmptyView doesn't render correctly | Wrap custom empty views in `ContentView`. |\n| Poor scroll performance | Use `MeasureFirstItem` sizing strategy for uniform item sizes. |\n| `ItemSizingStrategy` doesn't compile | It is declared on `StructuredItemsView` — set it on `\u003CCollectionView>`, not on `\u003CLinearItemsLayout>` \u002F `\u003CGridItemsLayout>`. |\n| Items clipped or stretched | `MeasureFirstItem` assumes uniform item size. Use the default `MeasureAllItems` for variable-height items. |\n| Selected state not visible | Add `VisualState Name=\"Selected\"` to the item template root element. |\n| Binding errors in SwipeView commands | Use `RelativeSource AncestorType` to reach the ViewModel from inside the item template. |\n\n## Validation\n\nBefore returning CollectionView markup you wrote or edited, confirm:\n\n- [ ] The `DataTemplate` root is a `View`\u002F`Layout` — **not** `ViewCell`.\n- [ ] `DataTemplate` declares `x:DataType` for compiled bindings.\n- [ ] `ItemsSource` is bound to `ObservableCollection\u003CT>` if the list mutates.\n- [ ] `ItemSizingStrategy` (if used) is on `\u003CCollectionView>`, not on the layout.\n- [ ] `Multiple` selection binds `SelectedItems`; `Single` binds `SelectedItem` (`TwoWay`).\n- [ ] `RefreshView.IsRefreshing` is set back to `false` when the refresh completes.\n- [ ] The answer covers **only** what the user asked — no unrequested sections.\n\n## References\n\n- [CollectionView overview](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Fuser-interface\u002Fcontrols\u002Fcollectionview\u002F)\n- [CollectionView layout](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Fuser-interface\u002Fcontrols\u002Fcollectionview\u002Flayout)\n- [CollectionView selection](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Fuser-interface\u002Fcontrols\u002Fcollectionview\u002Fselection)\n- [CollectionView grouping](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Fuser-interface\u002Fcontrols\u002Fcollectionview\u002Fgrouping)\n- [CollectionView scrolling](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Fuser-interface\u002Fcontrols\u002Fcollectionview\u002Fscrolling)\n- [CollectionView EmptyView](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Fuser-interface\u002Fcontrols\u002Fcollectionview\u002Femptyview)\n","# CollectionView — .NET MAUI\n\n`CollectionView` is the primary control for displaying scrollable lists and grids of data in .NET MAUI. It replaces `ListView` with better performance, flexible layouts, and no `ViewCell` requirement.\n\n## When to Use\n\n- Displaying a scrollable list or grid of data items\n- Binding a collection of objects to a templated item layout\n- Adding selection (single or multiple), grouping, or pull-to-refresh\n- Implementing infinite scroll \u002F incremental loading\n- Showing swipe actions on list items\n- Displaying an empty state when no data is available\n\n## When Not to Use\n\n- Static layouts with a fixed number of items — use `Grid` or `StackLayout` directly\n- Map pin lists — use the `Microsoft.Maui.Controls.Maps` NuGet package\n- Table-based data entry forms — use standard form controls\n- Simple text-only lists with no interaction — consider `BindableLayout` on a `StackLayout`\n\n## Scope Control — Answer Only What Was Asked\n\nThis skill is a **reference you consult**, not a checklist you apply. Most requests\nneed one or two sections from it. Pulling in the rest makes the answer worse.\n\n**Stop conditions — do NOT act when:**\n\n- **The user asked a narrow question.** Answer that question only. Do not append\n  grouping, swipe actions, empty views, snap points, or performance tips that\n  were not asked about.\n- **The user's existing code already works.** Do not rewrite working markup to\n  match the examples here. Point out a concrete defect; if there is none, say so\n  and answer the question that was asked.\n- **The change is stylistic.** Renaming, reordering attributes, or restructuring\n  a template that already behaves correctly is churn, not a fix.\n- **The control isn't `CollectionView`.** `CarouselView`, `BindableLayout`, and\n  `ListView`-in-maintenance code have different rules. Do not rewrite `ListView`\n  code the user did not ask about — but if they ask *which* control to use, or are\n  migrating from Xamarin.Forms, recommend `CollectionView` (see\n  [Migrating from ListView](#migrating-from-listview)).\n- **The problem is really a binding, DI, or navigation problem** that happens to\n  involve a list — defer to `maui-data-binding`, `maui-dependency-injection`, or\n  `maui-shell-navigation`.\n\n**The API sections below are a reference, not a checklist — offer them only when\nrelevant.** Four rules are non-negotiable, because violating them produces code that\ndoes not work or silently loses compile-time checking:\n\n1. Never use `ViewCell` as a `DataTemplate` root in `CollectionView`.\n2. Use `ObservableCollection\u003CT>` when the list mutates after first render.\n3. Mutate the bound collection on the UI thread.\n4. Set `x:DataType` on every `DataTemplate` (and on the page root) for compiled bindings.\n\nEverything else — sizing strategy, snap points, header\u002Ffooter, empty views — is\noptional and should be offered only when it addresses the user's actual problem.\n\n## Inputs\n\n- A data source (typically `ObservableCollection\u003CT>`) bound to `ItemsSource`\n- A `DataTemplate` defining how each item renders\n- Optional: layout configuration, selection mode, grouping model, empty view\n\n## Basic Setup\n\nA complete, copy-pasteable page. Two things are load-bearing: the `xmlns:models`\ndeclaration that every `x:DataType=\"models:Item\"` in this skill assumes, and the\n**root `x:DataType`** — without it the outer `ItemsSource` binding is not compiled:\n\n```xml\n\u003CContentPage xmlns=\"http:\u002F\u002Fschemas.microsoft.com\u002Fdotnet\u002F2021\u002Fmaui\"\n             xmlns:x=\"http:\u002F\u002Fschemas.microsoft.com\u002Fwinfx\u002F2009\u002Fxaml\"\n             xmlns:models=\"clr-namespace:MyApp.Models\"\n             xmlns:vm=\"clr-namespace:MyApp.ViewModels\"\n             x:DataType=\"vm:ItemsViewModel\"\n             x:Class=\"MyApp.ItemsPage\">\n    \u003CContentPage.BindingContext>\n        \u003Cvm:ItemsViewModel \u002F>\n    \u003C\u002FContentPage.BindingContext>\n    \u003CCollectionView ItemsSource=\"{Binding Items}\">\n        \u003CCollectionView.ItemTemplate>\n            \u003CDataTemplate x:DataType=\"models:Item\">\n                \u003CHorizontalStackLayout Padding=\"8\" Spacing=\"8\">\n                    \u003CImage Source=\"{Binding Icon}\" WidthRequest=\"40\" HeightRequest=\"40\" \u002F>\n                    \u003CLabel Text=\"{Binding Name}\" VerticalOptions=\"Center\" \u002F>\n                \u003C\u002FHorizontalStackLayout>\n            \u003C\u002FDataTemplate>\n        \u003C\u002FCollectionView.ItemTemplate>\n    \u003C\u002FCollectionView>\n\u003C\u002FContentPage>\n```\n\nLater snippets show only the `CollectionView` element. When you hand a snippet to a\nuser, include the matching `xmlns:` declaration for any prefix it uses, or the XAML\nwill not compile.\n\nThe inline `\u003CContentPage.BindingContext>` above keeps the example self-contained. In\nan app that uses dependency injection, register the ViewModel instead and assign it\nthrough constructor injection (`BindingContext = vm;`) — see the\n**maui-dependency-injection** skill.\n\n**Key rules:**\n\n- Bind `ItemsSource` to an `ObservableCollection\u003CT>` so the UI updates on add\u002Fremove.\n- Each item template root must be a `Layout` or `View` — **never use `ViewCell`**.\n- Always set `x:DataType` on `DataTemplate` for compiled bindings.\n\n## Layouts\n\nSet `ItemsLayout` to control arrangement. Default is `VerticalList`.\n\n| Layout | XAML value |\n|---|---|\n| Vertical list | `VerticalList` (default) |\n| Horizontal list | `HorizontalList` |\n| Vertical grid | `GridItemsLayout` with `Orientation=\"Vertical\"` |\n| Horizontal grid | `GridItemsLayout` with `Orientation=\"Horizontal\"` |\n\n### Grid Layout\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding Items}\">\n    \u003CCollectionView.ItemsLayout>\n        \u003CGridItemsLayout Orientation=\"Vertical\"\n                         Span=\"2\"\n                         VerticalItemSpacing=\"8\"\n                         HorizontalItemSpacing=\"8\" \u002F>\n    \u003C\u002FCollectionView.ItemsLayout>\n    \u003CCollectionView.ItemTemplate>\n        \u003CDataTemplate x:DataType=\"models:Item\">\n            \u003CBorder Padding=\"8\" StrokeThickness=\"0\">\n                \u003CVerticalStackLayout>\n                    \u003CImage Source=\"{Binding Image}\" HeightRequest=\"120\" Aspect=\"AspectFill\" \u002F>\n                    \u003CLabel Text=\"{Binding Name}\" FontAttributes=\"Bold\" \u002F>\n                \u003C\u002FVerticalStackLayout>\n            \u003C\u002FBorder>\n        \u003C\u002FDataTemplate>\n    \u003C\u002FCollectionView.ItemTemplate>\n\u003C\u002FCollectionView>\n```\n\n### Horizontal List\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding Items}\"\n                ItemsLayout=\"HorizontalList\" \u002F>\n```\n\n## Selection\n\n### Selection Mode\n\n| Mode | Property to bind | Binding mode |\n|---|---|---|\n| `None` | — | — |\n| `Single` | `SelectedItem` | `TwoWay` |\n| `Multiple` | `SelectedItems` | `OneWay` |\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding Items}\"\n                SelectionMode=\"Single\"\n                SelectedItem=\"{Binding CurrentItem, Mode=TwoWay}\"\n                SelectionChangedCommand=\"{Binding ItemSelectedCommand}\" \u002F>\n```\n\nFor `Multiple` selection, bind `SelectedItems` (type `IList\u003Cobject>`):\n\n```xml\n\u003CCollectionView SelectionMode=\"Multiple\"\n                SelectedItems=\"{Binding ChosenItems, Mode=OneWay}\" \u002F>\n```\n\n### Selected Visual State\n\nHighlight selected items using `VisualStateManager`:\n\n```xml\n\u003CCollectionView.ItemTemplate>\n    \u003CDataTemplate x:DataType=\"models:Item\">\n        \u003CGrid Padding=\"8\">\n            \u003CVisualStateManager.VisualStateGroups>\n                \u003CVisualStateGroup Name=\"CommonStates\">\n                    \u003CVisualState Name=\"Normal\">\n                        \u003CVisualState.Setters>\n                            \u003CSetter Property=\"BackgroundColor\" Value=\"Transparent\" \u002F>\n                        \u003C\u002FVisualState.Setters>\n                    \u003C\u002FVisualState>\n                    \u003CVisualState Name=\"Selected\">\n                        \u003CVisualState.Setters>\n                            \u003CSetter Property=\"BackgroundColor\"\n                                    Value=\"{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource PrimaryDark}}\" \u002F>\n                        \u003C\u002FVisualState.Setters>\n                    \u003C\u002FVisualState>\n                \u003C\u002FVisualStateGroup>\n            \u003C\u002FVisualStateManager.VisualStateGroups>\n            \u003CLabel Text=\"{Binding Name}\" \u002F>\n        \u003C\u002FGrid>\n    \u003C\u002FDataTemplate>\n\u003C\u002FCollectionView.ItemTemplate>\n```\n\n## Grouping\n\n1. Create a group class inheriting from `List\u003CT>`:\n\n```csharp\npublic class AnimalGroup : List\u003CAnimal>\n{\n    public string Name { get; }\n    public AnimalGroup(string name, List\u003CAnimal> animals) : base(animals)\n    {\n        Name = name;\n    }\n}\n```\n\n2. Bind to `ObservableCollection\u003CAnimalGroup>` and set `IsGrouped=\"True\"`:\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding AnimalGroups}\"\n                IsGrouped=\"True\">\n    \u003CCollectionView.GroupHeaderTemplate>\n        \u003CDataTemplate x:DataType=\"models:AnimalGroup\">\n            \u003CLabel Text=\"{Binding Name}\"\n                   FontAttributes=\"Bold\"\n                   BackgroundColor=\"{StaticResource Gray100}\"\n                   Padding=\"8\" \u002F>\n        \u003C\u002FDataTemplate>\n    \u003C\u002FCollectionView.GroupHeaderTemplate>\n    \u003CCollectionView.ItemTemplate>\n        \u003CDataTemplate x:DataType=\"models:Animal\">\n            \u003CLabel Text=\"{Binding Name}\" Padding=\"16,4\" \u002F>\n        \u003C\u002FDataTemplate>\n    \u003C\u002FCollectionView.ItemTemplate>\n\u003C\u002FCollectionView>\n```\n\n## Pull-to-Refresh\n\nWrap `CollectionView` in a `RefreshView`. Set `IsRefreshing` back to `false` when done:\n\n```xml\n\u003CRefreshView IsRefreshing=\"{Binding IsRefreshing}\"\n             Command=\"{Binding RefreshCommand}\">\n    \u003CCollectionView ItemsSource=\"{Binding Items}\" \u002F>\n\u003C\u002FRefreshView>\n```\n\n## Incremental Loading (Infinite Scroll)\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding Items}\"\n                RemainingItemsThreshold=\"5\"\n                RemainingItemsThresholdReachedCommand=\"{Binding LoadMoreCommand}\" \u002F>\n```\n\n> ⚠️ **Do NOT use with non-virtualizing layouts.** `LinearItemsLayout` and `GridItemsLayout` support virtualization. Using `BindableLayout` on a `StackLayout` as an alternative to `CollectionView` has no virtualization, which triggers infinite threshold-reached events.\n\n## SwipeView — Binding from Inside DataTemplate\n\nCommands inside a `DataTemplate` can't directly reach your ViewModel. Use `RelativeSource AncestorType`:\n\n```xml\n\u003CCollectionView.ItemTemplate>\n    \u003CDataTemplate x:DataType=\"models:Item\">\n        \u003CSwipeView>\n            \u003CSwipeView.RightItems>\n                \u003CSwipeItems>\n                    \u003CSwipeItem Text=\"Delete\"\n                               BackgroundColor=\"Red\"\n                               Command=\"{Binding BindingContext.DeleteCommand, Source={RelativeSource AncestorType={x:Type ContentPage}}}\"\n                               CommandParameter=\"{Binding}\" \u002F>\n                \u003C\u002FSwipeItems>\n            \u003C\u002FSwipeView.RightItems>\n            \u003CGrid Padding=\"8\">\n                \u003CLabel Text=\"{Binding Name}\" \u002F>\n            \u003C\u002FGrid>\n        \u003C\u002FSwipeView>\n    \u003C\u002FDataTemplate>\n\u003C\u002FCollectionView.ItemTemplate>\n```\n\n## EmptyView\n\nShown when `ItemsSource` is empty or null.\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding SearchResults}\"\n                EmptyView=\"No items found.\" \u002F>\n```\n\nFor a custom empty view, wrap in `ContentView`:\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding SearchResults}\">\n    \u003CCollectionView.EmptyView>\n        \u003CContentView>\n            \u003CVerticalStackLayout HorizontalOptions=\"Center\" VerticalOptions=\"Center\">\n                \u003CImage Source=\"empty_state.png\" WidthRequest=\"120\" \u002F>\n                \u003CLabel Text=\"Nothing here yet\" HorizontalTextAlignment=\"Center\" \u002F>\n            \u003C\u002FVerticalStackLayout>\n        \u003C\u002FContentView>\n    \u003C\u002FCollectionView.EmptyView>\n\u003C\u002FCollectionView>\n```\n\n## Headers and Footers\n\n```xml\n\u003CCollectionView ItemsSource=\"{Binding Items}\">\n    \u003CCollectionView.Header>\n        \u003CLabel Text=\"Header\" FontAttributes=\"Bold\" Padding=\"8\" \u002F>\n    \u003C\u002FCollectionView.Header>\n    \u003CCollectionView.Footer>\n        \u003CLabel Text=\"Footer\" FontAttributes=\"Italic\" Padding=\"8\" \u002F>\n    \u003C\u002FCollectionView.Footer>\n\u003C\u002FCollectionView>\n```\n\nUse `HeaderTemplate` \u002F `FooterTemplate` when headers or footers are data-bound.\n\n## Scrolling\n\n### ScrollTo\n\nProgrammatically scroll by index or item:\n\n```csharp\n\u002F\u002F Scroll to index\ncollectionView.ScrollTo(index: 10, position: ScrollToPosition.Center, animate: true);\n\n\u002F\u002F Scroll to item\ncollectionView.ScrollTo(item: myItem, position: ScrollToPosition.MakeVisible, animate: true);\n```\n\n| ScrollToPosition | Behavior |\n|---|---|\n| `MakeVisible` | Scrolls just enough to make the item visible |\n| `Start` | Scrolls item to the start of the viewport |\n| `Center` | Scrolls item to the center of the viewport |\n| `End` | Scrolls item to the end of the viewport |\n\n### Snap Points\n\n```xml\n\u003CCollectionView.ItemsLayout>\n    \u003CLinearItemsLayout Orientation=\"Horizontal\"\n                       SnapPointsType=\"MandatorySingle\"\n                       SnapPointsAlignment=\"Center\" \u002F>\n\u003C\u002FCollectionView.ItemsLayout>\n```\n\n- `SnapPointsType`: `None`, `Mandatory`, `MandatorySingle`\n- `SnapPointsAlignment`: `Start`, `Center`, `End`\n\n## Migrating from ListView\n\n`ListView` still compiles, but **as of .NET 10** it is marked `[Obsolete]`\n(\"*ListView is deprecated. Please use CollectionView instead.*\"). It is **not**\nobsolete on .NET 9 and earlier, so check the project's target framework before\ndescribing it as deprecated. **If the user asks\nwhich control to use, or is migrating from Xamarin.Forms, recommend\n`CollectionView`** — it is faster, needs no `ViewCell`, and supports flexible\nlayouts. What to avoid is silently rewriting `ListView` code the user did not ask\nyou to touch.\n\n| `ListView` | `CollectionView` equivalent |\n|---|---|\n| `ViewCell` template root | Any `View`\u002F`Layout` root — **`ViewCell` is not supported** |\n| `ItemSelected` event | `SelectionChanged` event, or `SelectionChangedCommand` |\n| `ItemTapped` event | A `TapGestureRecognizer` in the item template — `SelectionChanged` only fires when the selection *changes*, so it will not re-fire on tapping the already-selected item |\n| `IsPullToRefreshEnabled` + `Refreshing` | Wrap the `CollectionView` in a `RefreshView` |\n| `IsGroupingEnabled` | `IsGrouped` |\n| `HasUnevenRows=\"True\"` | Default `ItemSizingStrategy=\"MeasureAllItems\"` |\n| `RowHeight` (fixed height) | Set the height in the item template. `MeasureFirstItem` only reuses the first item's measured size — it is not an explicit row height |\n| `SeparatorVisibility` \u002F `SeparatorColor` | **No equivalent** — draw a `BoxView`\u002F`Border` in the item template |\n\nThe missing separator API is the most common migration surprise: `CollectionView`\nhas no built-in separators, so add one to the template yourself.\n\n## Performance Tips\n\nApply these only when the user reports a performance problem or explicitly asks\nabout performance — they are not a default checklist.\n\n- **Use `MeasureFirstItem`** for uniform item sizes — significantly faster than the default\n  `MeasureAllItems`, which measures every item individually. Set it on the `CollectionView`\n  itself (it is declared on `StructuredItemsView`), **not** on `LinearItemsLayout` \u002F\n  `GridItemsLayout`:\n  ```xml\n  \u003CCollectionView ItemsSource=\"{Binding Items}\"\n                  ItemSizingStrategy=\"MeasureFirstItem\">\n      \u003CCollectionView.ItemTemplate>\n          \u003CDataTemplate x:DataType=\"models:Item\">\n              \u003CGrid Padding=\"8\" ColumnDefinitions=\"44,*\" ColumnSpacing=\"8\">\n                  \u003CImage WidthRequest=\"44\" HeightRequest=\"44\" \u002F>\n                  \u003CLabel Grid.Column=\"1\" Text=\"{Binding Name}\" VerticalOptions=\"Center\" \u002F>\n              \u003C\u002FGrid>\n          \u003C\u002FDataTemplate>\n      \u003C\u002FCollectionView.ItemTemplate>\n  \u003C\u002FCollectionView>\n  ```\n  **When `MeasureFirstItem` is the wrong choice** — keep the default `MeasureAllItems` if:\n  - Items vary in height (wrapping text, optional rows, images of differing aspect) — the\n    first item's size is applied to all, so the rest are clipped or stretched.\n  - A `DataTemplateSelector` returns different templates — the first item won't represent\n    the others.\n  - The first item is atypical (a header-like or \"featured\" row) — every item inherits its\n    size. Fixing this by reordering data is a smell; use `MeasureAllItems` instead.\n  - Item size depends on runtime data that isn't loaded yet when the first item is measured.\n- **Use `ObservableCollection\u003CT>` when the list mutates after first render.** It implements\n  `INotifyCollectionChanged`, so in-place `Add`\u002F`Remove`\u002F`Insert` update the UI incrementally.\n  A `List\u003CT>` is fine for a list that never changes after it is bound. Note that *replacing*\n  `ItemsSource` re-renders everything regardless of the collection type — so mutate the bound\n  collection in place rather than reassigning it.\n- **Update collections on the UI thread** — `MainThread.BeginInvokeOnMainThread(() => Items.Add(item))`.\n\n## Common Pitfalls\n\n| Issue | Fix |\n|---|---|\n| UI doesn't update when items change | Use `ObservableCollection\u003CT>`, not `List\u003CT>`. |\n| App crashes or blank items | **Never use `ViewCell`** — use `Grid`, `StackLayout`, or any `View` as template root. |\n| Items disappear or layout breaks | Always update `ItemsSource` and the collection on the **UI thread** (`MainThread.BeginInvokeOnMainThread`). |\n| Incremental loading fires endlessly | Don't use `StackLayout` as layout; use `LinearItemsLayout` or `GridItemsLayout`. |\n| EmptyView doesn't render correctly | Wrap custom empty views in `ContentView`. |\n| Poor scroll performance | Use `MeasureFirstItem` sizing strategy for uniform item sizes. |\n| `ItemSizingStrategy` doesn't compile | It is declared on `StructuredItemsView` — set it on `\u003CCollectionView>`, not on `\u003CLinearItemsLayout>` \u002F `\u003CGridItemsLayout>`. |\n| Items clipped or stretched | `MeasureFirstItem` assumes uniform item size. Use the default `MeasureAllItems` for variable-height items. |\n| Selected state not visible | Add `VisualState Name=\"Selected\"` to the item template root element. |\n| Binding errors in SwipeView commands | Use `RelativeSource AncestorType` to reach the ViewModel from inside the item template. |\n\n## Validation\n\nBefore returning CollectionView markup you wrote or edited, confirm:\n\n- [ ] The `DataTemplate` root is a `View`\u002F`Layout` — **not** `ViewCell`.\n- [ ] `DataTemplate` declares `x:DataType` for compiled bindings.\n- [ ] `ItemsSource` is bound to `ObservableCollection\u003CT>` if the list mutates.\n- [ ] `ItemSizingStrategy` (if used) is on `\u003CCollectionView>`, not on the layout.\n- [ ] `Multiple` selection binds `SelectedItems`; `Single` binds `SelectedItem` (`TwoWay`).\n- [ ] `RefreshView.IsRefreshing` is set back to `false` when the refresh completes.\n- [ ] The answer covers **only** what the user asked — no unrequested sections.\n\n## References\n\n- [CollectionView overview](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Fuser-interface\u002Fcontrols\u002Fcollectionview\u002F)\n- [CollectionView layout](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Fuser-interface\u002Fcontrols\u002Fcollectionview\u002Flayout)\n- [CollectionView selection](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Fuser-interface\u002Fcontrols\u002Fcollectionview\u002Fselection)\n- [CollectionView grouping](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Fuser-interface\u002Fcontrols\u002Fcollectionview\u002Fgrouping)\n- [CollectionView scrolling](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Fuser-interface\u002Fcontrols\u002Fcollectionview\u002Fscrolling)\n- [CollectionView EmptyView](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Fuser-interface\u002Fcontrols\u002Fcollectionview\u002Femptyview)\n",{"name":5,"license":14,"description":23},"Guidance for implementing CollectionView in .NET MAUI apps — data display, layouts (list & grid), selection, grouping, scrolling, empty views, templates, incremental loading, swipe actions, and pull-to-refresh. USE FOR: \"CollectionView\", \"list view\", \"grid layout\", \"data template\", \"item template\", \"grouping\", \"pull to refresh\", \"incremental loading\", \"swipe actions\", \"empty view\", \"selection mode\", \"scroll to item\", displaying scrollable data, replacing ListView. DO NOT USE FOR: simple static layouts without scrollable data (use Grid or StackLayout), map pin lists (use Microsoft.Maui.Controls.Maps), table-based data entry forms, non-MAUI list controls, CarouselView or BindableLayout questions, platform-specific handler or renderer customization, diagnosing CollectionView bugs in the MAUI framework itself, or general MVVM\u002Fbinding questions that merely happen to mention a list (use maui-data-binding).\n","main","ccab8dffc0ecc173838f51e4c5f0d3b51a704f41","plugins\u002Fopt-in\u002Fimplementation\u002Fcsharp-skills\u002Flibrary\u002Fmaui-collectionview","https:\u002F\u002Fgithub.com\u002Fdeadmade\u002Fdead-agent-skills","https:\u002F\u002Fgithub.com\u002Fdeadmade","https:\u002F\u002Fdeadmade.github.io\u002F","Blood, an Ocean of blood","2026-11-14 02:03:31",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add deadmade\u002Fdead-agent-skills --skill maui-collectionview",{"tool":38,"command":39},"bunx","bunx skills add deadmade\u002Fdead-agent-skills --skill maui-collectionview",{"tool":41,"command":42},"pnpm","pnpm dlx skills add deadmade\u002Fdead-agent-skills --skill maui-collectionview","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdeadmade\u002Fdead-agent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fopt-in\u002Fimplementation\u002Fcsharp-skills\u002Flibrary\u002Fmaui-collectionview\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fcollectionview-api.md","REFERENCE","参考文档",7365,"https:\u002F\u002Fgithub.com\u002Fdeadmade\u002Fdead-agent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fopt-in\u002Fimplementation\u002Fcsharp-skills\u002Flibrary\u002Fmaui-collectionview\u002Freferences\u002Fcollectionview-api.md",[53,60,69,77,84,91],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":18},"01M7CVRBFTXSTTQ7F5P6PJEFYA","rust-best-practices","Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook. Use this skill when: (1) writing new Rust code or functions, (2) reviewing or refactoring existing Rust code, (3) deciding between borrowing vs cloning or ownership patterns, (4) implementing error handling with Result types, (5) optimizing Rust code for performance, (6) writing tests or documentation for Rust projects.","https:\u002F\u002Fgithub.com\u002Fdeadmade\u002Fdead-agent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fopt-in\u002Fimplementation\u002Frust-skills\u002Fskills\u002Frust-best-practices\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":64,"licenseFileUrl":65,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":18},"01M7CVR0W7B8EGTNPSPA7FPC4Z","postgres-database-migration","Use this skill for planning, testing, and safely executing PostgreSQL schema migrations — especially when working with production data or shared databases.\n\n**Trigger when user asks to:**\n- Test a schema migration before applying it to production\n- Add, remove, or rename columns safely on a live table\n- Change a column's data type without downtime\n- Add or drop indexes, constraints, or foreign keys on large tables\n- Understand which ALTER TABLE operations lock the table\n- Roll back a failed migration\n- Plan a zero-downtime migration strategy\n- Fork a database to test a migration safely\n\nCovers: lock-level reference for every common DDL operation, safe migration patterns, fork-based testing, zero-downtime column changes, index creation, constraint addition, backfill strategies, pre\u002Fpost-migration validation, and rollback planning.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fdeadmade\u002Fdead-agent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fopt-in\u002Fimplementation\u002Fpostgres\u002Fskills\u002Fpostgres-database-migration\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdeadmade\u002Fdead-agent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fopt-in\u002Fimplementation\u002Fpostgres\u002Fskills\u002Fpostgres-database-migration\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":64,"licenseFileUrl":73,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":18},"01M7CVQWK20ASAZN5VETZC8J99","postgres-best-practices","Best practices and guidelines for working with Postgres. Covers schema design, indexing strategies, query optimization, migrations, and common pitfalls. Use when writing SQL, designing database schemas, optimizing queries, or setting up a Postgres database.","https:\u002F\u002Fgithub.com\u002Fdeadmade\u002Fdead-agent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fopt-in\u002Fimplementation\u002Fpostgres\u002Fskills\u002Fpostgres-best-practices\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdeadmade\u002Fdead-agent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fopt-in\u002Fimplementation\u002Fpostgres\u002Fskills\u002Fpostgres-best-practices\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":18},"01M7CVQ5CY7AQHY7A2Y99RE6A7","writing-mstest-tests","ALWAYS USE when asked to fix, rewrite, update, improve, modernize, show corrected code for, or explain existing MSTest tests or MSTest-specific configuration. Use for \"review\" when corrected code or edits are wanted, even for one pasted assertion or passing tests with bad failure output. Covers expected\u002Factual labels; generic Boolean, collection, string, numeric, null, identity, exception, hard-cast, and object[] checks; TestContext\u002Flifecycle; timeout\u002Fcancellation; OS\u002FCI conditions, retry, cleanup, parallelization, MSTest.Sdk project setup, and MSTESTxxxx. Honor the installed MSTest version. DO NOT USE to design new test cases (code-testing), perform report-only audits, create project files rather than explain MSTest setup, run tests, migrate frameworks, or handle non-MSTest\u002Fnon-.NET code.","https:\u002F\u002Fgithub.com\u002Fdeadmade\u002Fdead-agent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fopt-in\u002Fimplementation\u002Fcsharp-skills\u002Flibrary\u002Fwriting-mstest-tests\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":18},"01M7CVPWJZ63GB0810F0SCGZ1K","winforms-expert","Create, modify, debug, or review Windows Forms applications only when the request contains a concrete Windows Forms marker. USE FOR: WinForms, Windows Forms, System.Windows.Forms, WinForms Form or UserControl designer files (*.Designer.cs or *.Designer.vb), Visual Studio WinForms Designer, TableLayoutPanel, BindingSource, DataGridView, Control.InvokeAsync, component-tray ownership, or custom control serialization. DO NOT USE FOR: WPF or WPF XAML, including Window.InputBindings, KeyBinding, commands, or DataContext; .NET MAUI; Avalonia; or any request where none of the listed Windows Forms markers is present.","https:\u002F\u002Fgithub.com\u002Fdeadmade\u002Fdead-agent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fopt-in\u002Fimplementation\u002Fcsharp-skills\u002Flibrary\u002Fwinforms-expert\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":18},"01M7CVPR0QFZ1HMJ6GZRBQAQ7W","vectorization","Design, implement, optimize, and review SIMD code in .NET. USE FOR: vectorizing scalar loops with TensorPrimitives, Vector64\u002F128\u002F256\u002F512, or platform hardware intrinsics; reviewing existing SIMD code, including the generic Vector type, for contract equivalence, tail handling, memory safety, portability, fallbacks, and measured performance. DO NOT USE FOR: performance work unrelated to SIMD or vectorization.","https:\u002F\u002Fgithub.com\u002Fdeadmade\u002Fdead-agent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fopt-in\u002Fimplementation\u002Fcsharp-skills\u002Flibrary\u002Fvectorization\u002FSKILL.md",[],[]]