WPF application development.
To place multiple identical combinations of controls,
A user control including the following controls is created.
・ Image
for displaying images -TextBlock for displaying only image names
-TextBlock that displays the full path of the image
・ Button to set the image

If somewhere in the user control is clicked
I want to visually indicate that the target user control is selected
* Borders are displayed on the outside, etc.

Because I don't have much experience creating apps with WPF,
I would appreciate it if you could give me a method and other advice.

Problems i am experiencing

In code-behind,
I tried to change the background color in the focus event of the user control, etc.
An event does not occur depending on the click location etc.
I have no clue how to implement it

Applicable source code


Supplemental information (FW/tool version etc.)

.NET Framework 4

  • Answer # 1

    ItemsControl is useful for layouts that repeat

    It looks like this

  • Answer # 2

    In order to pick up a mouse event, it seems that something needs to exist there.
    You can now set the transparent fill setting for the control and take an event wherever you click in the user control.

    Reference URL