Seting property in Match not working...

hi Guys

Not sure if I got this right but here it goes…

I’m creating a reusable component (button) that changes its color based on the “type” of button it is… similar to Bootstrap buttons.

I am using the MATCH condition to do this, and passing the property BtnType with value “success” or “warning”

Dunno what’s wrong with the above code, but it’s not working. No errors neither… What am I missing here?

This very recent post should be relevant. :slight_smile: (specifically points 2 and 3)

Remi Pedersen wrote:

This very recent post should be relevant. :slight_smile: (specifically points 2 and 3)

Hi Remi,
read the post. I understand and based on 2 and specially 3, I changed my code to the following:

  <Match String="{Property this.BtnType}">
    <Case String="success"> <Rectangle CornerRadius="4" Layer="Background" Color="#00cc00" />	</Case>
	 <Case String="warning"> <Rectangle CornerRadius="4" Layer="Background" Color="Yellow" />	 </Case>
  </Match>        						        

Works quite well…

Thank you

I could just make an observable for BtnType and let JS do the logic but that’s additional code work and dependency… So I chose to just simplify the reusable component with the above match case instead, and not deal w/ JS dependency.

That sounds like the right decision to me. Good to hear you got it working! :slight_smile: