I have a MAUI app. The initial XAML markup looks like this:
<mops:PopupPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:mops="clr-namespace:Mopups.Pages;assembly=Mopups"
xmlns:tools="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:vmods="clr-namespace:LockAndKey.Pages"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:DataType="vmods:DbViewModel"
x:Class="LockAndKey.Pages.DbUpdte"
CloseWhenBackgroundIsClicked="False"
BackgroundColor="#80000000">
As you can see I'm using Community Toolkit for MAUI. What I'm trying to do is mask an entry control like a telephone number entry. So I have the XAML entry control like this:
<Entry Placeholder="Enter owner's phone number"
Grid.Row="2" Margin="20,0,10,0"
Text="{Binding DbPhone}" Keyboard="Numeric">
<Entry.Behaviors>
<tools:MaskedBehavior Mask="(000) 000-0000"/>
</Entry.Behaviors>
</Entry>
And this is the data binding for the control:
public string DbPhone
{
get => _phone;
set
{
_phone = value;
OnPropertyChanged(nameof(DbPhone));
}
}
When I run the program and tab town to this entry control, no numeric keypad shows up, and when I enter a phone number, nothing is entered into the control. How can I fix this?
Keyboard="Numeric"works inconsistently between platforms and models, knowing which platform can give some insight what you need and what workarounds you can use.