How to create a text collecor in wpf?

Sarah 186 Reputation points
2022-10-14T20:10:01.443+00:00

I would like to recreate the following image in WPF. A text is added via a TextBox and an Add button. The special thing about this is that each added text should have a cross to delete this text again and a frame with a colored background.

250671-textcollector.png

I have no idea how to do this. Maybe someone has an approach or example?

Any help is appreciated

Developer technologies | Windows Presentation Foundation
{count} votes

1 answer

Sort by: Most helpful
  1. Hui Liu-MSFT 48,711 Reputation points Microsoft External Staff
    2022-10-17T06:34:19.607+00:00

    The solution of Viorel-1 is great. I made the sample code below. You could try to refer to it.

    250957-eee.txt

    ----------------------------------------------------------------------------

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.