Search code examples
wpftemplatestextmarkup-extensions

WPF show small number beside all Controls


I have many FrameworkElements (TextBlock, CheckBox, ListBox..) and I would like to make something allowing me to show a small number besides every one control.

Some text ³

I came with the idea to write a MarkupExtension, where I could write that number like this:

..
<TextBlock Text="Some Text" SomeExtension="3" />
..

and then to add it somehow to the template of the Control.

But I'm sure, you guys have better solution for this problem ;)


Solution

  • One way to go with it would be create a Attached Property. Upon setting it on a control, a custom Adorner would be added for that control showing specified number.