Implement Picker control#81
Merged
jonathanpeppers merged 12 commits intomainfrom Feb 14, 2026
Merged
Conversation
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement Picker and add test scenarios
Implement Picker control
Feb 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new cross-platform Picker control to Spice (core + iOS + Android), along with unit tests, a scenario sample, and documentation updates reflecting the new control.
Changes:
- Introduces
Pickercore API (Items,SelectedIndex,SelectedItem,Title,TextColor). - Adds native implementations using
UIPickerView(iOS) andSpinner(Android). - Adds unit tests + a scenario demo, and updates the MAUI controls comparison doc.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Spice.Tests/PickerTests.cs | Adds unit tests for Picker core behaviors and property notifications. |
| src/Spice/Core/Picker.cs | Defines the core Picker API and selection model. |
| src/Spice/Platforms/iOS/Picker.cs | Implements iOS native wiring via UIPickerView + model. |
| src/Spice/Platforms/Android/Picker.cs | Implements Android native wiring via Spinner + ArrayAdapter. |
| samples/Spice.Scenarios/Scenarios/PickerScenario.cs | Adds a scenario demonstrating picker-driven color selection. |
| samples/Spice.Scenarios/App.cs | Adds a navigation button to launch the new picker scenario. |
| docs/MAUI-CONTROLS-COMPARISON.md | Marks Picker as implemented and updates counts/mappings. |
…ker-tests # Conflicts: # docs/MAUI-CONTROLS-COMPARISON.md # samples/Spice.Scenarios/App.cs
- Fix missing using directives (ObservableCollection, Specialized) in iOS/Android - Fix Colors reference in tests (add Microsoft.Maui.Graphics using) - Fix App.cs: separate Picker and Slider into individual Button instances - Fix Color constructor: use Color.FromRgb(200, 200, 0) for Yellow - Raise PropertyChanged for SelectedItem when SelectedIndex/Items change - Subscribe to Items.CollectionChanged for live Add/Remove/Clear updates - Clamp SelectedIndex to valid range (Spinner/UIPickerView require selection) - Implement GetAttributedTitle on iOS to honor TextColor Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # samples/Spice.Scenarios/App.cs
- Remove null checks on OnItemsChanged params (non-nullable per generator) - Replace AddAll with foreach loop to avoid ICollection/Object[] ambiguity Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The CommunityToolkit.Mvvm source generator declares oldValue as nullable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The generated setter fires OnPropertyChanged(SelectedIndex) after the partial method that raises OnPropertyChanged(SelectedItem). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Adds dropdown/selection control using native platform widgets:
UIPickerView(iOS) andSpinner(Android).Implementation
Core (
Core/Picker.cs)Items: ObservableCollection<string>- data sourceSelectedIndex: int- current selection (-1 for none)SelectedItem: string?- computed from index, null-safeTitle: string- prompt text (Android only)TextColor: Color?- item text coloriOS (
Platforms/iOS/Picker.cs)UIPickerViewModelwithWeakReference<Picker>to prevent retain cyclesAndroid (
Platforms/Android/Picker.cs)ArrayAdapter<string>backed by Items collectione.Position != _selectedIndexUsage
Tests & Sample
PickerScenariodemonstrates color selection with live UI updates💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.