I am building an app using Xamarin Forms. I have the following code for my keyboard:
<StackLayout Orientation="Horizontal" Grid.Row="2" Margin="0,0,0,20">
<Entry Keyboard="Numeric" HeightRequest="200" WidthRequest="200"/>
</StackLayout>
This is what appears on my app:
Will the keyboard appear using on XAML? Or do I need to use C# to make it appear? What's causing the keyboard to not show up?
CodePudding user response:
I added a get method to the .cs file that is assigned to that particular xaml file.
public static Keyboard Numeric { get; }
The keyboard appears when I click on the area pictured above.
CodePudding user response:
I can't reproduce the problem. Here is code that works - what is different from yours? You'll need to experiment with changes to your code, to find out what exactly is causing the problem.
You can download the repo. See SoftKeyboardEntryPage. In project TestBugs, file App.xaml.cs, be sure to set MainPage = new SoftKeyboardEntryPage();
.
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TestBugs.SoftKeyboardEntryPage">
<ContentPage.Content>
<StackLayout>
<Entry Keyboard="Numeric" Text="Test" HeightRequest="100" WidthRequest="200" BackgroundColor="Pink"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>
When I click in the pink area, the numeric keyboard appears.
When I click in the white area, the keyboard goes away.
Also, when the app is running in iOS simulator, on Simulator's menu bar at top of Mac screen, try toggling IO / Keyboard / Toggle Soft Keyboard
on and off. Does that have any effect?
Maybe also UNCHECK Connect Hardware Keyboard
- though for me the soft keyboard appears even when the Mac's keyboard is connected.
However, I couldn't find any situation where the Soft Keyboard failed to show up, regardless of those settings.
Tested with simulator running iPhone 13 Pro, iOS 15.0.