Trigger functions properly on iOS and not Android

TrevorHeinsTrevorHeins USMember ✭✭

I am using teleriks RadListView to have cell swipe capabilites in a ListView. I have a swipe button that is connected to a clicked trigger to change the text and button. On iOS it only changes the color and text of the specific button that was pressed. On Android, it changes all of the buttons colors and text. I want only the button that was clicked to change, like it behaves on iOS.~~~~ This is how I have the trigger setup:

<Button.Triggers>
    <EventTrigger Event="Clicked">
        <local:TasksButtonTriggerAction />
    </EventTrigger>
</Button.Triggers>

And this is the TasksButtonTriggerAction implementation:

public class TasksButtonTriggerAction : TriggerAction<Button>
{
    protected override void Invoke(Button sender)
    {
        if (sender.Text.ToLower() == "start")
        {
            sender.BackgroundColor = Color.Red;
            sender.Text = "Complete";
            sender.TextColor = Color.White;
        }
        else
        {
            sender.BackgroundColor = Color.FromHex("#80BD01");
            sender.Text = "Start";
            sender.TextColor = Color.FromHex("#15315A");
        }

    }
}

Answers

  • karanthakkarkaranthakkar USMember ✭✭

    @TrevorHeins
    you can set platform specific conditions while triggering event i.e

     if (Device.OS == TargetPlatform.Android)
                {
                    // DO
                }
                else
                {
                    // DO NOT
                }
    

    may be it can do your job.

Sign In or Register to comment.