This effect allows user to show/hide softkeyboard on Android/iOS platform in Xamarin.Forms
- Need Xamarin.Forms version 3 or above
Xamarin.EnableKeyboardEffect
Available on NuGet: https://www.nuget.org/packages/Xamarin.EnableKeyboardEffect- Install into your platform-specific projects (iOS/Android), and any .NET Standard 2.0 projects required for your app.
- Add
xmlns:effects="clr-namespace:Xamarin.EnableKeyboardEffect;assembly=Xamarin.EnableKeyboardEffect"
at the top of the xaml file
Platform | Supported | Version | Notes |
---|---|---|---|
Xamarin.iOS | Yes | iOS 8+ | |
Xamarin.Android | Yes | API 16+ | Project should target Android framework 8.1+ |
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
Xamarin.EnableKeyboardEffect.iOS.Effects.Init();//need this line to init effect in iOS
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
<Entry Text="Show Keyboard" effects:EnableKeyboardEffect.EnableKeyboard="True">
<Entry.Effects>
<effects:KeyboardEnableEffect/>
</Entry.Effects>
</Entry>
<Entry Text="Hide Keyboard" effects:EnableKeyboardEffect.EnableKeyboard="False">
<Entry.Effects>
<effects:KeyboardEnableEffect/>
</Entry.Effects>
</Entry>
<Entry Text="Toggle Keyboard" effects:EnableKeyboardEffect.EnableKeyboard="{Binding VisibleBinding}">
<Entry.Effects>
<effects:KeyboardEnableEffect/>
</Entry.Effects>
</Entry>
Only support Android and iOS for the moment.
Contributions are welcome. Feel free to file issues and pull requests on the repo and they'll be reviewed as time permits.
Under MIT, see LICENSE file.