IsVisible - Different Behavior on UWP vs Android/iOS [Bug]
#6536 aperta il 14 giu 2019
Metriche repository
- Star
- (5644 stelle)
- Metriche merge PR
- (Nessuna PR mergiata in 30 g)
Descrizione
Description
Your documentation at https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.visualelement.isvisible?view=xamarin-forms#Xamarin_Forms_VisualElement_IsVisible states following: "Setting IsVisible to false will remove the element from the visual tree. The element will no longer take up space in layouts or be eligle to receive any kind of input event."
This however is only true on UWP, not on Android and IOS.
If you have an Entry as IsVisible=False, that entry will still be able to receive focus and input on Android and IOS which is correct behavior as setting to IsVisible to False does not mean the view is not present in visual tree, it is just not visible.
However, on UWP, that Entry will not be able to receive input nor Focus()
Steps to Reproduce
- Create a simplest possible app
- Add Entry and make it IsVisible=False
- Add button with code behind calling var isFocused = myEntry.Focus() to programaticaly attempt to focus on this hidden entry, put braek point on this line
- Run on Android and IOS and breakpoint will reveal that Focus was successful and returned True
- run on UWP and breakpoint will reveal that Focus failed and returned False
Expected Behavior
Entry should receive Focus on all 3 platforms (Android, iOS and UWP)
Actual Behavior
However, focus is received only on Android and IOS. UWP does not work
Basic Information
- Version with issue: Xamarin Forms v. 4.0.0.482894
- Last known good version:
- IDE: VS Enterprise 2017 v 15.8.7
- Platform Target Frameworks:
- iOS: Xamarin.iOS and Xamarin.Mac SDK 12.0.0.15 (84552a4)
- Android: Xamarin.Android SDK 9.0.0.19
- UWP: Target 17134, Min 16299
- Android Support Library Version:
- Nuget Packages:
- Affected Devices: