Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Display Requirement Specific Keyboard Using Xamarin.Forms

DZone's Guide to

Display Requirement Specific Keyboard Using Xamarin.Forms

· Mobile Zone
Free Resource

Launching an app doesn’t need to be daunting. Whether you’re just getting started or need a refresher on mobile app testing best practices, this guide is your resource! Brought to you in partnership with Perfecto

Xamarin uses the Keyboard class to show different virtual keyboards depending upon the user request. It contains several static properties to create different kind of virtual keyboards. Xamarin displays the Default Keyboard, if nothing is specified.

Keyboard for Chatting

MainPage = new ContentPage()
{
    Content = new StackLayout()
    {
        Children = 
        { 
            new Entry()
            {
                Keyboard = Keyboard.Chat 
            }
        }
    }
};

ChatKeyboard

It opens up the default virtual keyboard in the device, which would be convenient for chatting, having few extra keys.

Keyboard for Email entry

MainPage = new ContentPage()
{
    Content = new StackLayout()
    {
        Children = 
        { 
            new Entry()
            {
                Keyboard = Keyboard.Email 
            }
        }
    }
};

It opens up the same text virtual keyboard with some additional options for Email entering.

Keyboard for Numeric input

MainPage = new ContentPage()
{
    Content = new StackLayout()
    {
        Children = 
        { 
            new Entry()
            {
                Keyboard = Keyboard.Numeric
            }
        }
    }
};

NumericKeyboard

It opens up the numeric virtual keyboard in the device. It helps entering numbers and decimals in the entry field.

Keyboard for Telephone number input

MainPage = new ContentPage()
{
    Content = new StackLayout()
    {
        Children = 
        { 
            new Entry()
            {
                Keyboard = Keyboard.Telephone
            }
        }
    }
};

This opens up the numeric virtual keyboard in the device with some additional keys like +, *, #, – etc to help user in entering telephone number.

Keyboard for Text input

MainPage = new ContentPage()
{
    Content = new StackLayout()
    {
        Children = 
        { 
            new Entry()
            {
                Keyboard = Keyboard.Text
            }
        }
    }
};

It opens up a very much similar keyboard as the Default one.

Keyboard for Url input

MainPage = new ContentPage()
{
    Content = new StackLayout()
    {
        Children = 
        { 
            new Entry()
            {
                Keyboard = Keyboard.Url
            }
        }
    }
};

The keyboard opened up by this method is same as like the Email.

Keyboard to make the first letter of the sentence capitalized

MainPage = new ContentPage()
{
    Content = new StackLayout()
    {
        Children = 
        { 
            new Entry()
            {
                Keyboard = Keyboard.Create(KeyboardFlags.CapitalizeSentence)
            }
        }
    }
};

CapalizedKeyboard

It opens up the same Default keyboard but makes first letter of the sentence automatically capitalized.

Keyboard for spell checking

MainPage = new ContentPage()
{
    Content = new StackLayout()
    {
        Children = 
        { 
            new Entry()
            {
                Keyboard = Keyboard.Create(KeyboardFlags.Spellcheck)
            }
        }
    }
};

SpellKeybord

It opens up the same Default keyboard but checks the spelling during typing.

Keyboard to auto suggest the word

MainPage = new ContentPage()
{
    Content = new StackLayout()
    {
        Children = 
        { 
            new Entry()
            {
                Keyboard = Keyboard.Create(KeyboardFlags.Suggestions)
            }
        }
    }
};

SuggestionKeyboard

It opens up the same Default keyboard but suggest the words to the user during typing.

Happy coding  :)

Keep up with the latest DevTest Jargon with the latest Mobile DevTest Dictionary. Brought to you in partnership with Perfecto.

Topics:
java ,mobile ,android ,tutorial ,visual studio ,csharp ,windows phone ,ios ,xamarin ,cross platform mobile app

Published at DZone with permission of Nirmal Hota, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}