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

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,686 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Hui Liu-MSFT 40,866 Reputation points Microsoft Vendor
    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.