Schedule / Appointments / Custom Categories and Time Markers
Custom Categories and Time Markers

NOV Schedule allows you to fully customize the appointment tags (categories and time markers) of a schedule. You can easily add, remove and rename categories and time markers.

 Customizing Categories

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.

 Customizing Time Markers

Customizing time markers is similar to customizing categories.

Time markers are accessible through the TimeMarkers property of the schedule. To rename a predefined time marker, simply change the value of its Name property:

Renaming predefined categories
Copy Code
schedule.TimeMarkers[0].Name = NLoc.Get("Renamed Time Marker");

To add a new time marker, use the Add method of the TimeMarkers collection:

Adding custom time markers
Copy Code
NTimeMarker timeMarker1 = new NTimeMarker(NLoc.Get("Custom Time Marker 1"), NColor.Khaki);
schedule.TimeMarkers.Add(timeMarker1);

NTimeMarker timeMarker2 = new NTimeMarker(NLoc.Get("Custom Time Marker 2"), new NHatchFill(ENHatchStyle.DiagonalBrick, NColor.Red, NColor.Orange));
schedule.TimeMarkers.Add(timeMarker2);

To remove a time marker use the Remove or the RemoveAt method of the Categories collection:

Removing time markers
Copy Code
// Remove the second time marker
schedule.TimeMarkers.RemoveAt(1);

// Remove the time marker called "Busy"
NTimeMarker timeMarkerToRemove = schedule.TimeMarkers.FindByName(NLoc.Get("Busy"));
if (timeMarkerToRemove != null)
{
    schedule.TimeMarkers.Remove(timeMarkerToRemove);
}
See Also