Skip to content

Picker Attribute "SelectedIndex" Not being respected on page load - fix#22353

Closed
kubaflo wants to merge 1 commit into
dotnet:mainfrom
kubaflo:fix-9150
Closed

Picker Attribute "SelectedIndex" Not being respected on page load - fix#22353
kubaflo wants to merge 1 commit into
dotnet:mainfrom
kubaflo:fix-9150

Conversation

@kubaflo
Copy link
Copy Markdown
Contributor

@kubaflo kubaflo commented May 12, 2024

Fixes #9150
Fixes #22028

For the following code:

        <Picker FontSize="15"
                AutomationId="picker"
                SelectedIndex="1"
                x:Name="picker">
            <Picker.ItemsSource>
                <x:Array Type="{x:Type x:String}">
                    <x:String>0</x:String>
                    <x:String>1</x:String>
                    <x:String>2</x:String>
                </x:Array>
            </Picker.ItemsSource>
        </Picker>
Before After

@kubaflo kubaflo requested a review from a team as a code owner May 12, 2024 14:47
@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label May 12, 2024
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@dotnet dotnet deleted a comment from azure-pipelines Bot May 20, 2024
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Copy Markdown
Contributor

@kubaflo Could you rebase to fix the conflicts? Thanks in advance.

@kubaflo
Copy link
Copy Markdown
Contributor Author

kubaflo commented Jun 7, 2024

@jsuarezruiz I've rebased and solved conflicts :)

@dotnet dotnet deleted a comment from azure-pipelines Bot Jun 13, 2024
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@kubaflo kubaflo self-assigned this Mar 9, 2025
@bhavanesh2001
Copy link
Copy Markdown
Contributor

Can this be reviewed?

Copy link
Copy Markdown
Contributor

@bhavanesh2001 bhavanesh2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of things I noticed

  • If i define my picker something like this
 <Picker  SelectedIndex="2"
                Title="Choose an item" SelectedIndexChanged="Picker_SelectedIndexChanged" 
                 >
            <Picker.Items>
                <x:String>Item 1</x:String>
                <x:String>Item 2</x:String>
                <x:String>Item 3</x:String>
                <x:String>Item 4</x:String>
                <x:String>Item 5</x:String>
            </Picker.Items>
        </Picker>

this will throw on page load in both iOS and Android

  • SelectedIndexChanged is getting fired on Page load in Android but not in iOS . I think it shouldn't get fired .

@kubaflo kubaflo closed this Feb 2, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows Picker control won't display the selected item Picker Attribute "SelectedIndex" Not being respected on page load on Android?

3 participants