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>









share|improve this question


























    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>









    share|improve this question
























      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>









      share|improve this question













      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 18 hours ago









      Lawrence Agulto

      134




      134
























          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/






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            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
































            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/






            share|improve this answer

























              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/






              share|improve this answer























                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/






                share|improve this answer












                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/







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 17 hours ago









                SushiHangover

                48.5k53582




                48.5k53582






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    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




















































































                    Popular posts from this blog

                    Schultheiß

                    Verwaltungsgliederung Dänemarks

                    Liste der Kulturdenkmale in Wilsdruff