Recently I have started development using Xamarin.Forms. I am creating an application in which I have to customize the button, so I created customButton class. Now, I want to access the button in custom class using object.name property but I am not able to do that. Can anyone suggest how I can do that.
Code
<local:CustomButton x:Name="signInButton" Text="Sign In" Clicked="OnLoginButtonClicked" TextColor ="White" FontSize="15" FontAttributes="Bold"/>
CustomButton class inside Android project
namespace Sample.Droid
{
class CustomButtonRenderer : ButtonRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
{
base.OnElementChanged(e);
if (Control != null)
{
//Want to access button name in if condition, instead of Control.
//Hope this will help you all in understanding my problem.
}
}
}
}
Thanks
ButtonRendererin your android project, usually we use anIDto identify the control, not name, so it is platform specific, so on which platform are you trying to get the name property? Or are you just want to get the custom renderer class name? - Grace Feng