Categories are accessible through the Categories property of the schedule. To rename a predefined category, simply change the value of its Name property.
| Renaming predefined categories |
Copy Code
|
|---|---|
schedule.Categories[0].Name = NLoc.Get("Renamed Category");
|
|
To add a new category, use the Add method of the Categories collection:
| Adding custom categories |
Copy Code
|
|---|---|
NCategory category1 = new NCategory(NLoc.Get("Custom Category 1"), NColor.Khaki); schedule.Categories.Add(category1); NCategory category2 = new NCategory(NLoc.Get("Custom Category 2"), new NHatchFill(ENHatchStyle.DiagonalBrick, NColor.Red, NColor.Orange)); schedule.Categories.Add(category2); |
|
To remove a category use the Remove or the RemoveAt method of the Categories collection:
| Removing categories |
Copy Code
|
|---|---|
// Remove the second category schedule.Categories.RemoveAt(1); // Remove the category called "Green" NCategory categoryToRemove = schedule.Categories.FindByName(NLoc.Get("Green")); if (categoryToRemove != null) { schedule.Categories.Remove(categoryToRemove); } |
|
It is best to use NLoc.Get when dealing with appointment tag names, in order to make your application localizable. For more information about localization, check out the Localization Overview topic.