Search
Palette Class
Remarks See Also
 





Represents a tool palette control that displays DiagramItem objects grouped into categories. Items from the palette can be added to a diagram by drag-and-drop.

Namespace: MindFusion.Diagramming.Mvc
Assembly: MindFusion.Diagramming.Mvc

 Syntax

C#  Copy Code

public class Palette

Visual Basic  Copy Code

Public Class Palette

 Remarks

 Content Security Policy

To allow for stricter CSP rules, the library no longer loads CSS scripts automatically. If you use Palette, you must explicitly link the common-ui.css file from distribution's themes folder.

The Palette is an Accordion subclass that displays ItemListView components as its child panels. Each ItemListView displays the items of a palette category.

Call the AddCategory method to define a category and create its respective accordion pane. Call AddItem to add an item to specified category.

Drag-and-drop operations create a copy of the dragged item, and set its size to NewInstanceSize. The copy is created by calling item's clone method. You can override clone to copy property values of custom item subclasses.

Icons in the list are drawn by scaling NewInstanceSize down to IconSize. E.g. if a list icon is half the size of the diagram item it creates, its graphic elements such as cells, labels, strokes would be rendered at half scale too (as opposed to rendering with same label / stroke sizes but in smaller bounding rectangle). The scaling code assumes MeasureUnit of the target diagram and the palette have matching values.

Configuring the control

Palette can be created inside a Razor page either by invoking the Palette html helper, or by adding a <mindfusion-palette> tag helper:

Razor  Copy Code

@addTagHelper *, MindFusion.Diagramming.Mvc
....
<mindfusion-palette
    component=(Palette)ViewBag.Palette
    style="width:100%; height:100%;">
</mindfusion-palette>

 Inheritance Hierarchy

System.Object
    MindFusion.Diagramming.Mvc.Palette

 See Also