xamarin/Xamarin.Forms

Xamarin.Forms.Picker Focused property strange behavior in UWP

オープン

#9,128 opened on 2020/01/08

 (2 件のコメント) (0 件のリアクション) (0 人の担当者)C# (1,926 件のフォーク)batch import
e/4 :clock4:help wantedinactivep/UWPt/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

Description

Focused property does not appear to be tied to whether or not the user is manipulating the picker

Steps to Reproduce

  1. Start with the Xamarin.Forms Bindable Picker sample: https://docs.microsoft.com/en-us/samples/xamarin/xamarin-forms-samples/userinterface-bindablepicker/

  2. Add a SelectedIndexChanged event handler to the picker, so it looks like this:

     <Picker Title="Select a color" 
             ItemsSource="{Binding ColorNames}" 
             SelectedItem="{Binding SelectedColorName, Mode=TwoWay}"
             SelectedIndexChanged="Picker_SelectedIndexChanged"/>
    
  3. Implement the event handler like this:

     private void Picker_SelectedIndexChanged(object sender, System.EventArgs e)
     {
     	var picker = sender as Picker;
     	bool focused = picker.IsFocused;
     	if (!focused)
     	{
     		int x = 3;
     	}
     }
    
  4. Set a breakpoint on the line "int x = 3;"

  5. Run the UWP project.

  6. Set the color in the UI.

  7. Change the color.

Expected Behavior

At step 7, the picker should be focused, so the breakpoint should not be hit.

Actual Behavior

The breakpoint is hit.

Basic Information

  • Version with issue:
  • Last known good version:
  • IDE:
  • Platform Target Frameworks:
    • UWP: Target version is 17763. I don't know if that is what I actually build against or not.
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices: Windows

Screenshots

Reproduction Link

コントリビューターガイド