Setting selected state on a button in Xamarin Android

So you'd like to change the appearance of a button and for it to keep that appearance as long as it has been selected? This will change the appearance of the button to have a 4dp deep border along the bottom side of the bottom as long as it is selected.

In your view, add an on click delegate:

var myButton = (Button)Activity.FindViewById(Resource.Id.myButton);
myButton.Click += delegate
{
    myButton.Selected = true;
};

Define your layout and button, setting the background to a drawable defined below:

<LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <Button
            android:id="@+id/myButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="My Button" />
    </LinearLayout>

Create an xml file btn_border.xml in drawable:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_border_pressed" android:state_pressed="true" />
<item android:drawable="@drawable/btn_border_pressed" android:state_focused="true" />
<item android:drawable="@drawable/btn_border_pressed" android:state_selected="true" />
</selector>

Create a second xml file btn_border_pressed.xml in drawable:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:bottom="0dp" android:left="-4.5dp" android:right="-4.5dp" android:top="-4.5dp">
<shape android:shape="rectangle" >
<stroke android:width="4dp" android:color="@color/selected_red" />
</shape>
</item>
</layer-list>

And there you have it. Remember to set "selected" to false when you no longer want the button to hold the selected state.