dotnet / dotnet/maui

[iOS] Picker fails to open on first tap when Styles are changed on focus

Open
#32,127 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-controls-listview area-controls-picker platform/ios s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 14h
Merged PRs (30d)
296

Description

Description

When placing a Picker inside a ListView header and modifying its style within the OnFocus method, the picker requires multiple user interactions (clicks/taps) to open.

Expected Behavior:
The picker should open on the first click/tap.

Actual Behavior:
The picker only opens after multiple clicks/taps.

Additional Information:
This issue is reproducible only when the Picker is inside a ListView header. The problem does not occur when using a CollectionView header.

Image

<ListView>
	<ListView.Header>
			<Picker Focused="VisualElement_OnFocused"
			        Style="{StaticResource PickerUnSelectedStyle}"
			        Unfocused="Picker_OnUnfocused"
			        x:Name="Picker"
			        Title="Select a monkey">
				<Picker.ItemsSource>
					<x:Array Type="{x:Type x:String}">
						<x:String>Baboon</x:String>
						<x:String>Capuchin Monkey</x:String>
					</x:Array>
				</Picker.ItemsSource>
			</Picker>
	</ListView.Header>
</ListView>
private void VisualElement_OnFocused(object sender, FocusEventArgs e)
{
    Picker.Style = Application.Current?.Resources["PickerSelectedStyle"] as Style;
}

private void Picker_OnUnfocused(object sender, FocusEventArgs e)
{
    Picker.Style = Application.Current?.Resources["PickerUnSelectedStyle"] as Style;
}

Steps to Reproduce
  1. Run the attached sample
    SampleButtonCommandIssue.zip
  2. Click on the picker
Link to public reproduction project repository

No response

Version with bug

9.0.110 SR12

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

Use a CollectionView instead of ListView

Relevant log output

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the attached SampleButtonCommandIssue.zip on iOS and reproduce the Picker inside a ListView header while changing its Style in OnFocus. Compare the behavior with a CollectionView header and trace the focus and style-change interaction. Done means the Picker opens on the first tap without removing the described styling behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, ios
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.