checking is ellipse is filled or not following code below works fine but feels kind of a mess. any one has a better way to do this
I am creating a basic &quot;Enter Pin&quot; to unclick screen on a app. So if user enter 1st digit, than ellipse1 should be filled. and if user enter 2nd digit, than ellipse1 and ellipse2 should be filled. and if user enter 3rd digit, than ellipse1, ellipse2, and ellipse3 should get filled. and so on
in view class, I have 4 ellipse, representing 4 digit pin. if user enter a digit, ellipse color get filled.
in viewmodel, I am a method that check if digit was pressed. if it is than fill ellipse color
in helperclass, i am just checking if ellipse is transpaent (not pressed), or fill color (key was pressed)
view class
 &lt;Ellipse Fill=&quot;{Binding EllipseFill1}&quot; /&gt;
 &lt;Ellipse Fill=&quot;{Binding EllipseFill2}&quot; /&gt;
 &lt;Ellipse Fill=&quot;{Binding EllipseFill3}&quot; /&gt;
 &lt;Ellipse Fill=&quot;{Binding EllipseFill4}&quot; /&gt;

ViewModel class
  List&lt;int&gt; CreatePin = new List&lt;int&gt;; //4 digit pin is store here
  public void OnKeypadTapCommand(string value)
    {
        //Set color of Pin
        EllipseFill1 = helperCLass.SetColorPin(CreatePin, Brush.White, 1);
        EllipseFill2 = helperCLass.SetColorPin(CreatePin, Brush.White, 2);
        EllipseFill3 = helperCLass.SetColorPin(CreatePin, Brush.White, 3);
        EllipseFill4 = helperCLass.SetColorPin(CreatePin, Brush.White, 4);
    }

Heloperclass
    public Brush SetColorPin(List&lt;int&gt; valueList, Brush value, int PinNumber)
    {
        //Pin#1
        if (PinNumber == 1) 
        {
            if (valueList.Count == 0)
                return Brush.Transparent;
            else
                return value;
        }
        //Pin#2
        else if (PinNumber == 2)
        {
            if (valueList.Count == 0 || valueList.Count == 1)
                return Brush.Transparent;
            else
                return value;
        }
        //Pin#3
        else if (PinNumber == 3)
        {
            if (valueList.Count == 3 || valueList.Count == 4)
                return value; 
            else
                return Brush.Transparent;
        }
        //Pin#4
        else if (PinNumber == 4)
        {
            if (valueList.Count == 4)
                return value;
            else
                return Brush.Transparent;
        }
        else
        {
            return Brush.Transparent;
        }
        
    }
you could change the helper method to use switch if you're using C# 7.0 or higher then you can do this :
switch(PinNumber)
{
    case 1 when valueList.Count == 0:           
    case 2 when valueList.Count == 0 || valueList.Count == 1:
    case 3 when valueList.Count == 3 || valueList.Count == 4:
    case 4 valueList.Count == 4:
        return value;
    default: 
        return Brush.Transparent;
}

if not, then you can focus on readability by doing something like this :
var isPin1 = PinNumber == 1 &amp;&amp; valueList.Count != 0; 
var isPin2 = PinNumber == 2 &amp;&amp; valueList.Count == 0 || valueList.Count == 1; 
var isPin3 = PinNumber == 3 &amp;&amp; valueList.Count == 3 || valueList.Count == 4; 
var isPin4 = PinNumber == 4 &amp;&amp; valueList.Count == 4;

return isPin1 || isPin2 || isPin3 || isPin4 ? value : Brush.Transparent;