Forum Xamarin.Forms

How to change case for buttons?

Shiva799Shiva799 Member ✭✭
edited February 21 in Xamarin.Forms

I wish to change the text case of button in ios and uwp using effects but im not getting which control method I should use for the same.
Any inputs appreciated

Best Answer

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    Create subclass of Button we call it MyButton, and create custom renderer for MyButton .

    Custom Renderer

        [assembly: ExportRenderer(typeof(MyButton), typeof(MyRenderer))]
        namespace App2.iOS
        {
            class MyRenderer : ButtonRenderer
            {}
        }
    

    Usage in xaml

        xmlns:local ="clr-namespace:App2"
    
        <local:MyButton/>
    

    All the logic would only apply for those MyButton you used , not all the Button .

  • Shiva799Shiva799 Member ✭✭

    Renderer will affect all of my buttons. And I'm adding button from code behind. I used effects and its working well. I'd like to implement same for IOS and UWP but im not getting the exact property names to apply text effect on button text. If you have any leads on this please share

Sign In or Register to comment.