[Extensions] AlternateColor without item containers#763
Merged
Arlodotexe merged 17 commits intoCommunityToolkit:mainfrom Feb 7, 2026
Merged
[Extensions] AlternateColor without item containers#763Arlodotexe merged 17 commits intoCommunityToolkit:mainfrom
Arlodotexe merged 17 commits intoCommunityToolkit:mainfrom
Conversation
components/Extensions/src/ListViewBase/ListViewExtensions.AlternateRows.cs
Outdated
Show resolved
Hide resolved
11 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the AlternateColor functionality for ListViewBase to support scenarios where no item container is used. When an item container is unavailable, the extension now falls back to using the item itself if it's a Control.
Key changes:
- Added fallback logic to use the item as a Control when ItemContainer is unavailable
- Refactored code across multiple ListViewExtensions files for consistency and modern C# patterns
- Consolidated event cleanup logic with uniquely named unload handlers
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| ListViewExtensions.AlternateRows.cs | Added fallback logic to use args.Item when args.ItemContainer is null, refactored to use modern C# patterns, renamed methods/variables for clarity |
| ListViewExtensions.Command.cs | Refactored to use expression-bodied members and modern pattern matching for consistency |
| ListViewExtensions.StretchItemContainer.cs | Implemented previously missing event handlers, changed return type to nullable, refactored for consistency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
components/Extensions/src/ListViewBase/ListViewExtensions.StretchItemContainer.cs
Outdated
Show resolved
Hide resolved
components/Extensions/src/ListViewBase/ListViewExtensions.AlternateRows.cs
Outdated
Show resolved
Hide resolved
components/Extensions/src/ListViewBase/ListViewExtensions.AlternateRows.cs
Outdated
Show resolved
Hide resolved
components/Extensions/src/ListViewBase/ListViewExtensions.StretchItemContainer.cs
Outdated
Show resolved
Hide resolved
…tchItemContainer.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…rnateRows.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tchItemContainer.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…n alternate color is unset
Arlodotexe
reviewed
Feb 7, 2026
components/Extensions/src/ListViewBase/ListViewExtensions.AlternateRows.cs
Show resolved
Hide resolved
Arlodotexe
approved these changes
Feb 7, 2026
Member
Arlodotexe
left a comment
There was a problem hiding this comment.
Fully reviewed and tested. Approved! ![]()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #712
PR Type
What kind of change does this PR introduce?
What is the current behavior?
If a
ListViewBasedoes not use a container, for whatever reason, the item's background will not be altered.What is the new behavior?
If the
ItemContaineris not, the item itself will be used if the type is aControl.PR Checklist
Please check if your PR fulfills the following requirements:
Other information