Refactor multiple if-else conditions when condition is a minor change
This is a common problem. Sometimes it's tricky to generalise a process even when its iterative in nature.
By keeping track of both:

the location of the user's cursor (cursor_position), and
an iterable data structure storing which characters are shown (pinNumbers),

it is possible to implement this behaviour without so much repeated code. This gave the desired behaviour after some thorough testing (in my imagination).
public string PinCode { get; set; } = string.Empty;

private int cursor_position = -1;
private string[] pinNumbers = new string[] {&quot;_&quot;, &quot;_&quot;, &quot;_&quot;, &quot;_&quot;};

    private async Task&lt;bool&gt; SelectedButton(Button button)
    {
        //If button is a number then
        if (button.Text != null)
        {
            if ( cursor_position &lt; 3 )
            {
                PinCode = PinCode + button.Text;

                if ( cursor_position &gt; 0 )
                {
                    pinNumbers[cursor_position] = &quot;*&quot;;
                }

                cursor_position += 1;
                pinNumbers[cursor_position] = button.Text;
            }
        } else { // apparently backspace?
            if ( cursor_position &gt;= 0 )
            {
                PinCode = PinCode.Remove(PinCode.Length - 1);
                pin_numbers[cursor_position] = &quot;_&quot;;
                cursor_position -= 1;
            }
        }

        pinNumberOne   = pinNumbers[0]; // update actual shown values with array
        pinNumberTwo   = pinNumbers[1]; // you could probably take out the &quot;pinNumberX&quot; middleman
        pinNumberThree = pinNumbers[2]; // but I dont know what relation these variables have to
        pinNumberFour  = pinNumbers[3]; // the rest of your code

        return true;
    }

Depending on how you are assigning values to the actual rendered characters you may be able to remove the first four of the last five lines. You likely could just refer the rendered components directly to the values in the pinNumbers array.