jQuery can select the Child of something, or Parent, or next tag. Does C# have something similar to this behavior. For example, I have a horizontal StackPanel that has a Label, a TextBox, and a Button.
Can I target the Label to change color if the TextBox is currently selected without using if else statements referring to the name of the Label? Some function like “this label” in this StackPanel that this TextBox is in.
Example: Whenever a text box is selected, the label next to it changes to yellow background.

I’m not sure how to write this in C# so I will try to explain with regular text.
if (this) textbox is selected
get the label next to it
change the label background to a color
else
remove the color if it is not selected
The Method() will trigger based on the currently selected TextBox.
A function like this can have the same code but be able to target different Labels once the focus changes to a different TextBox. Is this possible?
Yes, You can; you should handle events. for example in this case you handle ‘TextBox.GotFocus` event.
If you want to omplete this example let me know.
Edit
This is a working Example:
Use this Window to show the results:
Here, is the CustomControl class: