How to use TagListControl in C#

By FoxLearn 7/19/2024 2:37:06 AM   11.36K
To create a tag using FerretLib.WinForms in C# Windows Forms, you can follow these steps.

TagListControl is a control of the FerretLib.WinForms library that helps you create the winform tag control.

The "TagList" control is designed to display and manage tag lists typically used in contexts such as blog posts. It provides functionality for both displaying existing tags and editing them.

This control is useful for applications where categorization or labeling of content through tags is a core feature, allowing users to easily add, remove, and modify tags associated with items like blog posts or other similar content types.

How to use TagListControl in C#

Open your Visual Studio, then create a new Windows Forms application, then enter your project name is "TagDemo" and click OK button.

You need to add the FerretLib.WinForms library to your project. You can do this by downloading the library from the FerretLib GitHub repository or by using NuGet Package Manager to install it.

If you want to install the FerretLib.WinForms library from nuget. You can right click on your project select Manage NuGet Packages -> Search FerretLib.WinForms -> Install it.

Next, You need to add the FerretLib.WinForms to your toolbox, then drag and drop the tag control to your form.

TagList is a control intended for displaying and editing tag lists as commonly used for things like blog posts. 

taglist

ResourceFontLoader: Helper class for loading fonts embedded as resources in your .exe Currently broken because of a .Net Framework bug which has been reported and gone unfixed since .Net 2.0 - do not count on this working any time soon

ColorPicker is an alternative to the ColorDialog for choosing colours based on ARGB values

color picker

You can see more details FerretLib.WinForms at GitHub.

Drag and drop the tag control from your Visual Studio toolbox to your windows form application, then you can design a simple form as shown below.

c# tag control

Here's a simple example demonstrating how to create a tag using FerretLib.WinForms in a C# Windows Forms application

Adding a Form Load event handler to your form as the following c# code.

private void Form1_Load(object sender, EventArgs e)
{
    //Init tags
    List<string> tags = new List<string>();
    tags.Add("C#");
    tags.Add("Windows Forms");
    tags.Add("WPF");
    tags.Add("WCF");
    tags.Add("ASP.NET");
    tags.AddRange(new string[] { "Web Services", "MVC", "Entity Framework" });
    tagListControl1.Tags = tags;
}

You can create a list of string, then add datasource to the TagListControl.

VIDEO TUTORIAL