My target is to bind the Content-Property of the Label to the Tag-Property of the Elements the Style is applied to. But m
If I understand correctly, you want to set the text for VisualBrush, that will be displayed in the TextBox.
You can do it like this:
In order to explain why your example not earned:
1. As you probably understand, looking at my example, RelativeSource must be not self, in which case it will point to itself (VisualBrush), and the element with the type must be of TextBox, located higher in the visual tree.
2. Binding with RelativeSource does not work in resources, because the Resource is not part of the visual tree, or part of the template.
3. In styles this construction will not work, because the Style is just the collection of setters, he does not know about control, are there. For this purpose, usually using DataTemplate or ControlTemplate.
As an alternative, in this case, I suggest using a template for the TextBox, which will be registered VisualBrush.
Below is my example:
Output
