Hello @LucasOtavio, I am really glad that my inputs provided you with more ideas!
Exactly, as @Rusk said, you have to insert the IF statement in the BorderColor property of the label you placed over the item. In PowerApps the IF statement works like this:
- IF ( condition , trueValue , falseValue );
Let's say for example that the items in your gallery are contained in a Table (the table's source is not important, you can write it yourself like I did here), you can create a Table like this:
Table(
{id: 1}, {id: 2}, {id: 3}
)
As you can see, I created the same exact Gallery and I then set the Items property to my Table (you might have a different source of data but that is not important since you can apply the same logic), then I created a label inside the gallery in order to visualize the id property of the item. In the second image you can see the Text property of that label:


Then once you've done this, in the OnSelect property of the Gallery you have to Set a variable to the ThisItem.id (or also to ThisItem itself like I did here, if you need all its properties for later) of the selected gallery entry, like this:

Finally, you will have to set the BorderColor property of the label you placed over your item like we've seen before, like in the following image:

In this case, since I selected the first element of the Gallery with ID 1, the selectedItem variable will contain the first row of the table, the condition of the IF statement in the BorderColor property will result to true and the red color will be applied to the border. As soon as I select another row, the selectedItem variable will contain the corresponding Table record, with another id which is different from 1, so the false outcome of the IF statement will be applied and the borderColor will be transparent.
You can create as many labels as you want and apply the same logic to create unlimited items (you could also duplicate the first label, change the position and then just change the id inside the IF statement).
If you need any more help please let me know,
have a nice day!