I would like to implement a functionality similar to jQuery TagIt into C# windows forms.
Here is the link for jQuery – http://aehlke.github.com/tag-it/
I am thinking of creating a user control for this functionality.
Any help on how to go about this?
You’re in luck, as there’s already a container control called a
FlowLayoutPanelthat will get you 90% of the way there as a flowing tag host.FlowLayoutPanel Class @ MSDN
This control is available from the Toolbox in Visual Studio, so a good starting point would be to make a custom control based upon a
FlowLayoutPanel, and another custom control to represent a tag based upon aLabelorCheckbox, and update the drawing and behavior (in the case of aLabel) to respond to clicks and to display the [x] to dismiss the tag.Label Class @ MSDN
CheckBox Class @ MSDN
After making these two controls, you will need to do additional work to make your FlowLayoutPanel-derived control add/remove Label-based controls representing the state of the tags present.
Update: One thing I missed, a
TextBoxor other input field would need to be added in place to support adding new tags.TextBox @ MSDN