How to auto-capitalize keyboard/entry in xamarin forms
up vote
0
down vote
favorite
I have two entries Username and Password. The username and password is always uppercase. How can I force the keyboard or the entry that when I type something the text will be uppercase?
<Frame StyleClass="lpframe" x:Name="usernameFrame" CornerRadius="5" BorderColor="Transparent" HasShadow="False">
<StackLayout>
<Label Text="USERNAME" StyleClass="lbl-login">
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Semibold.ttf#OpenSans-Semibold"/>
</OnPlatform>
</Label.FontFamily>
</Label>
<local:CustomEntry Placeholder="Username" PlaceholderColor="#879baa" Unfocused="entUser_Unfocused" StyleClass="form-control" ReturnType="Next" x:Name="entUser">
<local:CustomEntry.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Regular.ttf#OpenSans-Regular"/>
</OnPlatform>
</local:CustomEntry.FontFamily>
</local:CustomEntry>
</StackLayout>
</Frame>
<Frame StyleClass="lpframe" x:Name="passwordFrame" CornerRadius="5" BorderColor="Transparent" HasShadow="False">
<StackLayout>
<Label Text="PASSWORD" StyleClass="lbl-login">
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Semibold.ttf#OpenSans-Semibold"/>
</OnPlatform>
</Label.FontFamily>
</Label>
<local:CustomEntry Placeholder="Password" PlaceholderColor="#879baa" Unfocused="entPassword_Unfocused" IsPassword="True" StyleClass="form-control" ReturnType="Go" x:Name="entPassword">
<local:CustomEntry.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Regular.ttf#OpenSans-Regular"/>
</OnPlatform>
</local:CustomEntry.FontFamily>
</local:CustomEntry>
</StackLayout>
</Frame>
xamarin xamarin.forms xamarin.forms.entry
add a comment |
up vote
0
down vote
favorite
I have two entries Username and Password. The username and password is always uppercase. How can I force the keyboard or the entry that when I type something the text will be uppercase?
<Frame StyleClass="lpframe" x:Name="usernameFrame" CornerRadius="5" BorderColor="Transparent" HasShadow="False">
<StackLayout>
<Label Text="USERNAME" StyleClass="lbl-login">
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Semibold.ttf#OpenSans-Semibold"/>
</OnPlatform>
</Label.FontFamily>
</Label>
<local:CustomEntry Placeholder="Username" PlaceholderColor="#879baa" Unfocused="entUser_Unfocused" StyleClass="form-control" ReturnType="Next" x:Name="entUser">
<local:CustomEntry.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Regular.ttf#OpenSans-Regular"/>
</OnPlatform>
</local:CustomEntry.FontFamily>
</local:CustomEntry>
</StackLayout>
</Frame>
<Frame StyleClass="lpframe" x:Name="passwordFrame" CornerRadius="5" BorderColor="Transparent" HasShadow="False">
<StackLayout>
<Label Text="PASSWORD" StyleClass="lbl-login">
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Semibold.ttf#OpenSans-Semibold"/>
</OnPlatform>
</Label.FontFamily>
</Label>
<local:CustomEntry Placeholder="Password" PlaceholderColor="#879baa" Unfocused="entPassword_Unfocused" IsPassword="True" StyleClass="form-control" ReturnType="Go" x:Name="entPassword">
<local:CustomEntry.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Regular.ttf#OpenSans-Regular"/>
</OnPlatform>
</local:CustomEntry.FontFamily>
</local:CustomEntry>
</StackLayout>
</Frame>
xamarin xamarin.forms xamarin.forms.entry
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have two entries Username and Password. The username and password is always uppercase. How can I force the keyboard or the entry that when I type something the text will be uppercase?
<Frame StyleClass="lpframe" x:Name="usernameFrame" CornerRadius="5" BorderColor="Transparent" HasShadow="False">
<StackLayout>
<Label Text="USERNAME" StyleClass="lbl-login">
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Semibold.ttf#OpenSans-Semibold"/>
</OnPlatform>
</Label.FontFamily>
</Label>
<local:CustomEntry Placeholder="Username" PlaceholderColor="#879baa" Unfocused="entUser_Unfocused" StyleClass="form-control" ReturnType="Next" x:Name="entUser">
<local:CustomEntry.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Regular.ttf#OpenSans-Regular"/>
</OnPlatform>
</local:CustomEntry.FontFamily>
</local:CustomEntry>
</StackLayout>
</Frame>
<Frame StyleClass="lpframe" x:Name="passwordFrame" CornerRadius="5" BorderColor="Transparent" HasShadow="False">
<StackLayout>
<Label Text="PASSWORD" StyleClass="lbl-login">
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Semibold.ttf#OpenSans-Semibold"/>
</OnPlatform>
</Label.FontFamily>
</Label>
<local:CustomEntry Placeholder="Password" PlaceholderColor="#879baa" Unfocused="entPassword_Unfocused" IsPassword="True" StyleClass="form-control" ReturnType="Go" x:Name="entPassword">
<local:CustomEntry.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Regular.ttf#OpenSans-Regular"/>
</OnPlatform>
</local:CustomEntry.FontFamily>
</local:CustomEntry>
</StackLayout>
</Frame>
xamarin xamarin.forms xamarin.forms.entry
I have two entries Username and Password. The username and password is always uppercase. How can I force the keyboard or the entry that when I type something the text will be uppercase?
<Frame StyleClass="lpframe" x:Name="usernameFrame" CornerRadius="5" BorderColor="Transparent" HasShadow="False">
<StackLayout>
<Label Text="USERNAME" StyleClass="lbl-login">
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Semibold.ttf#OpenSans-Semibold"/>
</OnPlatform>
</Label.FontFamily>
</Label>
<local:CustomEntry Placeholder="Username" PlaceholderColor="#879baa" Unfocused="entUser_Unfocused" StyleClass="form-control" ReturnType="Next" x:Name="entUser">
<local:CustomEntry.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Regular.ttf#OpenSans-Regular"/>
</OnPlatform>
</local:CustomEntry.FontFamily>
</local:CustomEntry>
</StackLayout>
</Frame>
<Frame StyleClass="lpframe" x:Name="passwordFrame" CornerRadius="5" BorderColor="Transparent" HasShadow="False">
<StackLayout>
<Label Text="PASSWORD" StyleClass="lbl-login">
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Semibold.ttf#OpenSans-Semibold"/>
</OnPlatform>
</Label.FontFamily>
</Label>
<local:CustomEntry Placeholder="Password" PlaceholderColor="#879baa" Unfocused="entPassword_Unfocused" IsPassword="True" StyleClass="form-control" ReturnType="Go" x:Name="entPassword">
<local:CustomEntry.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="OpenSans-Regular.ttf#OpenSans-Regular"/>
</OnPlatform>
</local:CustomEntry.FontFamily>
</local:CustomEntry>
</StackLayout>
</Frame>
xamarin xamarin.forms xamarin.forms.entry
xamarin xamarin.forms xamarin.forms.entry
asked 18 hours ago
Lawrence Agulto
134
134
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
You can do it via a PlatformEffect
fairly easily.
Xaml Example:
<Entry Placeholder="Password" IsPassword="true">
<Entry.Effects>
<sushi:CapsEntrytEffect />
</Entry.Effects>
</Entry>
Note: xmlns:sushi in this example is a xmlns
for the location of the RoutingEffect
implementation
RoutingEffect in a NetStd library
This class is to be referenced via the sushi
xmlns in the XAML example
public class CapsEntrytEffect : RoutingEffect
{
public CapsEntrytEffect() : base("Sushi.CapsEntrytEffect")
{
}
}
PlatformEffect for Android
Note: You are adding a InputFilterAllCaps
to the Android Widget EditText's current filter list.
public class CapsEntrytEffect : PlatformEffect
{
protected override void OnAttached()
{
var editText = Control as EditText;
editText.SetFilters(editText.GetFilters().Append(new InputFilterAllCaps()).ToArray());
}
protected override void OnDetached()
{
}
}
PlatformEffect for iOS
public class CapsEntrytEffect : PlatformEffect
{
protected override void OnAttached()
{
var editField = Control as UITextField;
editField.AutocapitalizationType = UITextAutocapitalizationType.AllCharacters;
}
protected override void OnDetached()
{
}
}
In each one of projects that you implement a PlatformEffect, make sure you are including the ResolutionGroupName
and ExportEffect
attributes so Forms' can find and activate the effect for that platform.
ResolutionGroupName and ExportEffect Example::
[assembly: ResolutionGroupName("Sushi")]
[assembly: ExportEffect(typeof(CapsEntrytEffect), "CapsEntrytEffect")]
re: https://blog.xamarin.com/customizing-xamarin-forms-controls-with-effects/
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
You can do it via a PlatformEffect
fairly easily.
Xaml Example:
<Entry Placeholder="Password" IsPassword="true">
<Entry.Effects>
<sushi:CapsEntrytEffect />
</Entry.Effects>
</Entry>
Note: xmlns:sushi in this example is a xmlns
for the location of the RoutingEffect
implementation
RoutingEffect in a NetStd library
This class is to be referenced via the sushi
xmlns in the XAML example
public class CapsEntrytEffect : RoutingEffect
{
public CapsEntrytEffect() : base("Sushi.CapsEntrytEffect")
{
}
}
PlatformEffect for Android
Note: You are adding a InputFilterAllCaps
to the Android Widget EditText's current filter list.
public class CapsEntrytEffect : PlatformEffect
{
protected override void OnAttached()
{
var editText = Control as EditText;
editText.SetFilters(editText.GetFilters().Append(new InputFilterAllCaps()).ToArray());
}
protected override void OnDetached()
{
}
}
PlatformEffect for iOS
public class CapsEntrytEffect : PlatformEffect
{
protected override void OnAttached()
{
var editField = Control as UITextField;
editField.AutocapitalizationType = UITextAutocapitalizationType.AllCharacters;
}
protected override void OnDetached()
{
}
}
In each one of projects that you implement a PlatformEffect, make sure you are including the ResolutionGroupName
and ExportEffect
attributes so Forms' can find and activate the effect for that platform.
ResolutionGroupName and ExportEffect Example::
[assembly: ResolutionGroupName("Sushi")]
[assembly: ExportEffect(typeof(CapsEntrytEffect), "CapsEntrytEffect")]
re: https://blog.xamarin.com/customizing-xamarin-forms-controls-with-effects/
add a comment |
up vote
0
down vote
accepted
You can do it via a PlatformEffect
fairly easily.
Xaml Example:
<Entry Placeholder="Password" IsPassword="true">
<Entry.Effects>
<sushi:CapsEntrytEffect />
</Entry.Effects>
</Entry>
Note: xmlns:sushi in this example is a xmlns
for the location of the RoutingEffect
implementation
RoutingEffect in a NetStd library
This class is to be referenced via the sushi
xmlns in the XAML example
public class CapsEntrytEffect : RoutingEffect
{
public CapsEntrytEffect() : base("Sushi.CapsEntrytEffect")
{
}
}
PlatformEffect for Android
Note: You are adding a InputFilterAllCaps
to the Android Widget EditText's current filter list.
public class CapsEntrytEffect : PlatformEffect
{
protected override void OnAttached()
{
var editText = Control as EditText;
editText.SetFilters(editText.GetFilters().Append(new InputFilterAllCaps()).ToArray());
}
protected override void OnDetached()
{
}
}
PlatformEffect for iOS
public class CapsEntrytEffect : PlatformEffect
{
protected override void OnAttached()
{
var editField = Control as UITextField;
editField.AutocapitalizationType = UITextAutocapitalizationType.AllCharacters;
}
protected override void OnDetached()
{
}
}
In each one of projects that you implement a PlatformEffect, make sure you are including the ResolutionGroupName
and ExportEffect
attributes so Forms' can find and activate the effect for that platform.
ResolutionGroupName and ExportEffect Example::
[assembly: ResolutionGroupName("Sushi")]
[assembly: ExportEffect(typeof(CapsEntrytEffect), "CapsEntrytEffect")]
re: https://blog.xamarin.com/customizing-xamarin-forms-controls-with-effects/
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
You can do it via a PlatformEffect
fairly easily.
Xaml Example:
<Entry Placeholder="Password" IsPassword="true">
<Entry.Effects>
<sushi:CapsEntrytEffect />
</Entry.Effects>
</Entry>
Note: xmlns:sushi in this example is a xmlns
for the location of the RoutingEffect
implementation
RoutingEffect in a NetStd library
This class is to be referenced via the sushi
xmlns in the XAML example
public class CapsEntrytEffect : RoutingEffect
{
public CapsEntrytEffect() : base("Sushi.CapsEntrytEffect")
{
}
}
PlatformEffect for Android
Note: You are adding a InputFilterAllCaps
to the Android Widget EditText's current filter list.
public class CapsEntrytEffect : PlatformEffect
{
protected override void OnAttached()
{
var editText = Control as EditText;
editText.SetFilters(editText.GetFilters().Append(new InputFilterAllCaps()).ToArray());
}
protected override void OnDetached()
{
}
}
PlatformEffect for iOS
public class CapsEntrytEffect : PlatformEffect
{
protected override void OnAttached()
{
var editField = Control as UITextField;
editField.AutocapitalizationType = UITextAutocapitalizationType.AllCharacters;
}
protected override void OnDetached()
{
}
}
In each one of projects that you implement a PlatformEffect, make sure you are including the ResolutionGroupName
and ExportEffect
attributes so Forms' can find and activate the effect for that platform.
ResolutionGroupName and ExportEffect Example::
[assembly: ResolutionGroupName("Sushi")]
[assembly: ExportEffect(typeof(CapsEntrytEffect), "CapsEntrytEffect")]
re: https://blog.xamarin.com/customizing-xamarin-forms-controls-with-effects/
You can do it via a PlatformEffect
fairly easily.
Xaml Example:
<Entry Placeholder="Password" IsPassword="true">
<Entry.Effects>
<sushi:CapsEntrytEffect />
</Entry.Effects>
</Entry>
Note: xmlns:sushi in this example is a xmlns
for the location of the RoutingEffect
implementation
RoutingEffect in a NetStd library
This class is to be referenced via the sushi
xmlns in the XAML example
public class CapsEntrytEffect : RoutingEffect
{
public CapsEntrytEffect() : base("Sushi.CapsEntrytEffect")
{
}
}
PlatformEffect for Android
Note: You are adding a InputFilterAllCaps
to the Android Widget EditText's current filter list.
public class CapsEntrytEffect : PlatformEffect
{
protected override void OnAttached()
{
var editText = Control as EditText;
editText.SetFilters(editText.GetFilters().Append(new InputFilterAllCaps()).ToArray());
}
protected override void OnDetached()
{
}
}
PlatformEffect for iOS
public class CapsEntrytEffect : PlatformEffect
{
protected override void OnAttached()
{
var editField = Control as UITextField;
editField.AutocapitalizationType = UITextAutocapitalizationType.AllCharacters;
}
protected override void OnDetached()
{
}
}
In each one of projects that you implement a PlatformEffect, make sure you are including the ResolutionGroupName
and ExportEffect
attributes so Forms' can find and activate the effect for that platform.
ResolutionGroupName and ExportEffect Example::
[assembly: ResolutionGroupName("Sushi")]
[assembly: ExportEffect(typeof(CapsEntrytEffect), "CapsEntrytEffect")]
re: https://blog.xamarin.com/customizing-xamarin-forms-controls-with-effects/
answered 17 hours ago
SushiHangover
48.5k53582
48.5k53582
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203250%2fhow-to-auto-capitalize-keyboard-entry-in-xamarin-forms%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password