--- /dev/null
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+using Xamarin.Forms.PlatformConfiguration;
+using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 45723, "Entry / Editor and a Button. Tapping the button dismisses the keyboard", PlatformAffected.iOS)]
+ public class Bugzilla45723 : TestNavigationPage // or TestMasterDetailPage, etc ...
+ {
+ protected override void Init()
+ {
+ PushAsync(new EditorAndButtonReproPage());
+ }
+ }
+
+ public class EditorAndButtonReproPage : ContentPage
+ {
+ public EditorAndButtonReproPage()
+ {
+ BackgroundColor = Color.Gray;
+ Padding = 50;
+ var editor = new Editor { HorizontalOptions = LayoutOptions.FillAndExpand };
+ var editorButton = new Button { Text = "OK", HorizontalOptions = LayoutOptions.End };
+ editorButton.On<iOS>().SetCanBecomeFirstResponder(true);
+ var editorLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { editor, editorButton }, VerticalOptions = LayoutOptions.Start };
+ var endtry = new Entry { Placeholder = "Entry", HorizontalOptions = LayoutOptions.FillAndExpand };
+ var entryButton = new Button { Text = "OK", HorizontalOptions = LayoutOptions.End };
+ var entryLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { endtry, entryButton }, VerticalOptions = LayoutOptions.Start };
+ Content = new StackLayout
+ {
+ Children = {
+ new Label() { Text = "Click editor to make keyboard appear. Click ok and keyboard shouldn't disappear"},
+ editorLayout,
+ new Label() { Text = "Click entry to make keyboard appear. Click ok and keyboard should disappear"},
+ entryLayout
+ }
+ };
+ }
+ }
+}
\ No newline at end of file
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44338.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44980.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla45067.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla45723.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla45027.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla45330.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44955.cs" />
public static class VisualElement
{
- public static readonly BindableProperty BlurEffectProperty =
- BindableProperty.Create("BlurEffect", typeof(BlurEffectStyle),
- typeof(VisualElement), BlurEffectStyle.None);
+ public static readonly BindableProperty BlurEffectProperty = BindableProperty.Create("BlurEffect", typeof(BlurEffectStyle), typeof(VisualElement), BlurEffectStyle.None);
public static BlurEffectStyle GetBlurEffect(BindableObject element)
{
}
#endregion
+
+ public static readonly BindableProperty CanBecomeFirstResponderProperty = BindableProperty.Create(nameof(CanBecomeFirstResponder), typeof(bool), typeof(VisualElement), false);
+
+ public static bool GetCanBecomeFirstResponder(BindableObject element)
+ {
+ return (bool)element.GetValue(CanBecomeFirstResponderProperty);
+ }
+
+ public static void SetCanBecomeFirstResponder(BindableObject element, bool value)
+ {
+ element.SetValue(CanBecomeFirstResponderProperty, value);
+ }
+
+ public static bool CanBecomeFirstResponder(this IPlatformElementConfiguration<iOS, FormsElement> config)
+ {
+ return GetCanBecomeFirstResponder(config.Element);
+ }
+
+ public static IPlatformElementConfiguration<iOS, FormsElement> SetCanBecomeFirstResponder(this IPlatformElementConfiguration<iOS, FormsElement> config, bool value)
+ {
+ SetCanBecomeFirstResponder(config.Element, value);
+ return config;
+ }
}
}
platformEffect.SetControl(control);
}
+#if __MOBILE__
+ public override bool CanBecomeFirstResponder
+ {
+ get
+ {
+ if (Element.IsSet(PlatformConfiguration.iOSSpecific.VisualElement.CanBecomeFirstResponderProperty))
+ return PlatformConfiguration.iOSSpecific.VisualElement.GetCanBecomeFirstResponder(Element);
+
+ return base.CanBecomeFirstResponder;
+ }
+ }
+#endif
+
void IEffectControlProvider.RegisterEffect(Effect effect)
{
var platformEffect = effect as PlatformEffect;