[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DYJ05XVF8RWNHZY2R72PQV":3,"skill-same:01M6DYJ05XVF8RWNHZY2R72PQV":89},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":55,"commitSha":56,"skillDirectory":57,"forksCount":58,"repositoryHtmlUrl":59,"repositoryHomepageUrl":60,"ownerHtmlUrl":61,"ownerBlogUrl":62,"ownerDescription":63,"updatedAt":64,"install":65,"resources":78},"01M6DYJ05XVF8RWNHZY2R72PQV","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).","managedcode\u002Fdotnet-skills","managedcode","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F78253589?v=4","01M6DYDJR3EG8KB5G4PC65XCTT","Managed Code","01M6DYDJX0ZT432N04NYJW89DN",515,"MIT","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FFrameworks\u002FOfficial-DotNet-MAUI\u002Fskills\u002Fmaui-collectionview\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"maui collectionview","maui","grouping","static","handler","implementing","display","mode","loading","swipe","apps","platform","layout","map","forms","pull","do","selection","simple","general","maps","mvvm","use","refresh","view","list","pin","template","data","actions","2026-11-10 10:12:30",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":15,"description":54},"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","497cc9aba79a931ac6fb8d36a48cc22fe3d6d74b","catalog\u002FFrameworks\u002FOfficial-DotNet-MAUI\u002Fskills\u002Fmaui-collectionview",41,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills","https:\u002F\u002Fskills.managed-code.com","https:\u002F\u002Fgithub.com\u002Fmanagedcode","https:\u002F\u002Fwww.managed-code.com","Open Source Community for .NET Developers: Reliable, Actively Maintained, and Community-Driven. Made in Ukraine 🇺🇦 with ❤️","2026-11-14 19:05:44",{"source":8,"skillName":5,"commands":66,"prompt":76,"zipAvailable":77},[67,70,73],{"tool":68,"command":69},"npx","npx skills add managedcode\u002Fdotnet-skills --skill maui-collectionview",{"tool":71,"command":72},"bunx","bunx skills add managedcode\u002Fdotnet-skills --skill maui-collectionview",{"tool":74,"command":75},"pnpm","pnpm dlx skills add managedcode\u002Fdotnet-skills --skill maui-collectionview","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FFrameworks\u002FOfficial-DotNet-MAUI\u002Fskills\u002Fmaui-collectionview\u002FSKILL.md",true,[79,85],{"path":80,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":83,"sourceHtmlUrl":84},"manifest.json","REFERENCE","参考文档",163,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FFrameworks\u002FOfficial-DotNet-MAUI\u002Fskills\u002Fmaui-collectionview\u002Fmanifest.json",{"path":86,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Fcollectionview-api.md",7365,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FFrameworks\u002FOfficial-DotNet-MAUI\u002Fskills\u002Fmaui-collectionview\u002Freferences\u002Fcollectionview-api.md",[90,127,150,181,191,218],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":106,"publishedAt":49},"01M6DYQE1Y9FHAQHEDTVFQ3447","xtwitter-scraper","Use XTwitterScraper when a .NET application needs typed access to Xquik's X automation REST API for tweet search, user lookup, posting workflows, extraction jobs, monitors, webhooks, or giveaway draws. USE FOR: integrating the XTwitterScraper NuGet package; reviewing Xquik API client usage; modeling API-key configuration, pagination, binary exports, raw responses, retries, and webhook\u002Fevent flows in .NET. DO NOT USE FOR: unrelated stacks; direct browser automation; generic social-media strategy; or code that does not call Xquik. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FXTwitterScraper\u002Fskills\u002Fxtwitter-scraper\u002FSKILL.md",[96,101],{"categoryNo":97,"categoryName":98,"taxonomyType":99,"taxonomyTypeDesc":100},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":102,"categoryName":103,"taxonomyType":104,"taxonomyTypeDesc":105},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126],"xtwitter scraper","browser automation","workflows","run","code","browser","search","repository","api","Media","api client","access","edit","unrelated","webhooks","files","social","commands","modeling","webhook",{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":139,"publishedAt":49},"01M6DYQ9S4PE1H6G8MCH9T21HR","sep","Use Sep for high-performance separated-value parsing and writing in .NET, including delimiter inference, explicit parser\u002Fwriter options, and low-allocation row\u002Fcolumn workflows. USE FOR: delimited data needs are performance-sensitive and allocation-aware; project needs explicit control over separator inference, escaping, trimming, and header behavior;. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FSep\u002Fskills\u002Fsep\u002FSKILL.md",[133,136],{"categoryNo":134,"categoryName":135,"taxonomyType":99,"taxonomyTypeDesc":100},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":137,"categoryName":138,"taxonomyType":104,"taxonomyTypeDesc":105},"01JBSEEDCAT000000000000036","内容创作者",[129,140,141,109,142,110,114,47,143,144,119,145,120,122,35,146,147,148,124,149],"writing","performance","tasks","parsing","parser","context","writer","options","project","high-performance",{"skillNo":151,"name":152,"nameZh":6,"description":153,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":154,"categories":155,"keywords":156,"publishedAt":49},"01M6DZS2DNEPXCGGF6SSCW6G5V","webgpu-threejs-tsl","Comprehensive guide for developing WebGPU-enabled Three.js applications using TSL (Three.js Shading Language). Covers WebGPU renderer setup, TSL syntax and node materials, compute shaders, post-processing effects, and WGSL integration. Use this skill when working with Three.js WebGPU, TSL shaders, node materials, or GPU compute in Three.js.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fwebgpu-claude-skill\u002Fskills\u002Fwebgpu-threejs-tsl\u002FSKILL.md",[],[157,158,159,160,161,162,163,164,165,166,167,168,41,169,170,171,172,173,174,175,176,177,178,179,180],"webgpu","threejs","webgpu threejs tsl","setup","shaders","gpu","integration","applications","js","node","syntax","guide","language","three","compute","post","processing","with","renderer","for","materials","wgsl","effects","when",{"skillNo":182,"name":183,"nameZh":6,"description":184,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":185,"categories":186,"keywords":187,"publishedAt":49},"01M6DZS0BQXW2B56A289XF1X76","roslynk","Use Roslynk for semantic inspection and edits of *.cs, *.razor and *.cshtml solution files.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Froslynk\u002Fskills\u002Froslynk\u002FSKILL.md",[],[183,41,122,188,189,176,190],"semantic","razor","inspection",{"skillNo":192,"name":193,"nameZh":6,"description":194,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":195,"categories":196,"keywords":197,"publishedAt":49},"01M6DZRW6MEJCVW80K3S4XV60K","system-text-json-net11","Imperative guidance for the System.Text.Json APIs added in .NET 11: the built-in `JsonNamingPolicy.PascalCase` naming policy, and the strongly-typed generic `JsonSerializerOptions.GetTypeInfo` and `JsonSerializerOptions.TryGetTypeInfo` metadata accessors (generic overloads that return a typed `JsonTypeInfo`). USE ONLY when the user is targeting net11.0 or later and needs PascalCase JSON property or dictionary-key names without writing a custom naming policy, a strongly-typed generic `JsonTypeInfo` instead of the non-generic `JsonTypeInfo`, or a no-throw way to probe whether a type's serialization metadata is resolved. DO NOT USE when the target is earlier than net11.0, the requested behavior uses an established pre-net11 naming policy, or the user explicitly selected another JSON library.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fdotnet-skills\u002Fplugins\u002Fdotnet11\u002Fskills\u002Fsystem-text-json-net11\u002FSKILL.md",[],[198,199,200,201,140,202,203,204,205,206,207,41,208,209,210,211,35,212,213,214,215,176,216,217,180],"system","json","text","system text json net11","policy","metadata","library","serialization","behavior","user","only","probe","guidance","later","type","dictionary","naming","targeting","custom","generic",{"skillNo":219,"name":220,"nameZh":6,"description":221,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":222,"categories":223,"keywords":226,"publishedAt":49},"01M6DZRRJP3S662NFSG1RSPQQ7","process-api-net11","Provides guidance on the new System.Diagnostics.Process APIs introduced in .NET 11: Process.Run, Process.RunAndCaptureText, Process.StartAndForget, Process.ReadAllText\u002FBytes\u002FLines, KillOnParentExit, InheritedHandles, and StartDetached. USE FOR: starting, orchestrating, or capturing output from external processes in applications targeting net11.0 or later. DO NOT USE FOR: applications targeting .NET 10 or earlier, or basic pre-.NET 11 Process.Start usage without new APIs.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fdotnet-skills\u002Fplugins\u002Fdotnet11\u002Fskills\u002Fprocess-api-net11\u002FSKILL.md",[224,225],{"categoryNo":97,"categoryName":98,"taxonomyType":99,"taxonomyTypeDesc":100},{"categoryNo":102,"categoryName":103,"taxonomyType":104,"taxonomyTypeDesc":105},[115,227,228,229,110,230,164,198,41,210,211,35,231,232,233,234,215,176,235],"process","process api net11","diagnostics","start","basic","processes","output","usage","new"]