Claudiu Constantin
Claudiu Constantin

Reputation: 2228

Tag editing in a WPF TextBox

I want to implement a custom TextBox that will allow me to edit tags. Hotmail's "To" TextBox is the best example I can think of:

enter image description here

Also Facebook's "To" implements the same concept:

enter image description here

Oh yeah, and StackOverflow does it too to tag a question :)

Does anyone have some experience in building something like that in WPF? What would be the first steps that I should make?

Upvotes: 27

Views: 10017

Answers (2)

RegisteredUser
RegisteredUser

Reputation: 206

I believe this Tokenizing control does most of what you're looking for:

http://blog.pixelingene.com/2010/10/tokenizing-control-convert-text-to-tokens/

Upvotes: 16

Sebastian Edelmeier
Sebastian Edelmeier

Reputation: 4167

I'd try the following:

  • implement a TagEditor, which has the functionality to edit a single Tag (based on an AutoComplete TextBox that is swapped with a TextBlock once an existing Tag has been recognized or editing is ended)

  • create an DataTemplate that uses the TagEditor

  • create an ItemsControl that utilizes the DataTemplate

that breaks it down to three challenges, of which only the first is a bit tricky, but solveable with the given keywords and stackoverflow ;-)

Upvotes: 4

Related Questions