0

I would like to toggle the visible property of a button that is nested in a Gallery in my PowerApp.

What I tried to was to go off of whether the parent was selected. I placed this formula inside the Visible property.

ink its a type issue, but I am not sure what is the best way to fix this.

If(Parent.Selected = true, true, false)

I received an "Invalid argument type" error on the "=" operator, so I think that perhaps I have a type mismatch or some other issue.

Sporran
  • 11
  • 1
  • 3

2 Answers2

1

I feel like an idiot, because about 5 minutes after I asked the question I figured out the answer.

All I had to do was to use the followng as the conditional statement:

ThisItem.IsSelected

The full solution being:

If(ThisItem.IsSelected,true,false)

Maybe this can help another rookie too :)

Sporran
  • 11
  • 1
  • 3
  • If i'm not mistaken, because `ThisItem.IsSelected` evaluates to `true`/`false`, you can shorten your code to just `ThisItem.IsSelected`. You can do this for any statements that evaluate to t/f. – SeaDude May 05 '20 at 15:17
1

I believe you could also simplify this by using ThisItem.IsSelected for the visible property of the button.

SeaDude
  • 3,725
  • 6
  • 31
  • 68