New to Telerik UI for ASP.NET MVC? Start a free 30-day trial

Defines the fluent API for configuring the Telerik UI TreeMap for ASP.NET MVC.

Definition

Constructors

Initializes a new instance of the TreeMap class.

C#
public TreeMapBuilder(TreeMap component)
Parameters:componentTreeMap

The component.

Methods

If set to "false", the TreeMap will not bind to the DataSource during initialization. In this case, the data binding will occur when the Change event of the DataSource fires. By default the TreeMap will bind to its DataSource specified in the configuration.

C#
public TreeMapBuilder AutoBind(bool value)
Parameters:valuebool

The value that configures the AutoBind option.

Returns:

TreeMapBuilder

Example:
C#
@(Html.Kendo().TreeMap()
.Name("treeMap")
.AutoBind(false)
.DataSource(...)
)

Defines the data item field that contains the tile color.

C#
public TreeMapBuilder ColorField(string value)
Parameters:valuestring

The name of the Model property that holds the tile color.

Returns:

TreeMapBuilder

Example:
C#
@(Html.Kendo().TreeMap()
.Name("treeMap")
.ColorField("color")
.DataSource(dataSource => dataSource
.Read(read => read.Action("ActionName", "ControllerName"))
.Model(m => m.Children("Items"))
)
)

Defines the default colors for the TreeMap items (tiles).

C#
public TreeMapBuilder Colors(Action<TreeMapColorRangeFactory> configurator)
Parameters:configuratorAction<TreeMapColorRangeFactory>

The action that configures the colors.

Returns:

TreeMapBuilder

Example:
C#
@(Html.Kendo().TreeMap()
.Name("treeMap")
.Colors(color =&gt;
{
color.AddRange("#0072c6", "#cbe2f3");
color.AddRange("#5db2ff", "#deeffe");
})
)

Defines the default colors for the TreeMap items (tiles).

C#
public TreeMapBuilder Colors(params string[] value)
Parameters:valuestring[]

The array of colors or color ranges.

Returns:

TreeMapBuilder

Example:
C#
@(Html.Kendo().TreeMap()
.Name("treeMap")
.Colors(new string[]{ "#ff6666", "#7fb17f" })
)

Configures the DataSource of the TreeMap.

C#
public TreeMapBuilder DataSource(Action<HierarchicalDataSourceBuilder<object>> configurator)
Parameters:configuratorAction<HierarchicalDataSourceBuilder<object>>

The action that configures the DataSource(Action<HierarchicalDataSourceBuilder<object>>).

Returns:

TreeMapBuilder

Example:
C#
@(Html.Kendo().TreeMap()
.Name("treeMap")
.DataSource(dataSource =&gt; dataSource
.Read(read =&gt; read.Action("ActionName", "ControllerName"))
.Model(m =&gt; m.Children("Items"))
)
)

Configures the handled client-side events of the TreeMap.

C#
public TreeMapBuilder Events(Action<TreeMapEventBuilder> configurator)
Parameters:configuratorAction<TreeMapEventBuilder>

The action that configures the available events.

Returns:

TreeMapBuilder

Example:
C#
@( Html.Kendo().TreeMap()
.Name("TreeMap")
.Events(events =&gt; events
.DataBound("onDataBound")
)
)

Specifies the template that renders the content of the tile. The available fields in the template are:

  • dataItem: The original data item used to construct the point.
  • text: The original tile text.
C#
public TreeMapBuilder Template(string value)
Parameters:valuestring

The value that configures the content of the template.

Returns:

TreeMapBuilder

Example:
C#
@(Html.Kendo().TreeMap()
.Name("treeMap")
.Template("&lt;h2&gt;#=text#: #=dataItem.value#&lt;/h2&gt;")
)

Specifies the template that renders the content of the tile. The available fields in the template are:

  • dataItem: The original data item used to construct the point.
  • text: The original tile text.
C#
public TreeMapBuilder Template<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the template.

Returns:

TreeMapBuilder

Specifies the template that renders the content of the tile. The available fields in the template are:

  • dataItem: The original data item used to construct the point.
  • text: The original tile text.
C#
public TreeMapBuilder TemplateHandler(string value)
Parameters:valuestring

The value that configures the content of the template.

Returns:

TreeMapBuilder

Example:
C#
@(Html.Kendo().TreeMap()
.Name("treeMap")
.TemplateHandler("getTileTemplate")
)
&lt;script&gt;
function getTileTemplate(data) {
return `&lt;h2&gt;${data.text}: ${data.dataItem.value}&lt;/h2&gt;`;
}
&lt;/script&gt;

Specifies the template that renders the content of the tile. The available fields in the template are:

  • dataItem: The original data item used to construct the point.
  • text: The original tile text.
C#
public TreeMapBuilder TemplateId(string value)
Parameters:valuestring

The value that configures the content of the template.

Returns:

TreeMapBuilder

Example:
C#
@(Html.Kendo().TreeMap()
.Name("treeMap")
.TemplateId("tileTemplate")
)
&lt;script id="tileTemplate" type="text/x-kendo-template"&gt;
&lt;h2&gt;#=text#: #=dataItem.value#&lt;/h2&gt;
&lt;/script&gt;

Specifies the template that renders the content of the tile. The available fields in the template are:

  • dataItem: The original data item used to construct the point.
  • text: The original tile text.
C#
public TreeMapBuilder TemplateView(MvcHtmlString value)
Parameters:valueMvcHtmlString

The value that configures the content of the template.

Returns:

TreeMapBuilder

Example:
C#
@(Html.Kendo().TreeMap()
.Name("treeMap")
.TemplateView(Html.Partial("TileTemplateView"))
)

Defines the data item field that contains the tile title.

C#
public TreeMapBuilder TextField(string value)
Parameters:valuestring

The name of the Model property that holds the title of the tile.

Returns:

TreeMapBuilder

Example:
C#
@(Html.Kendo().TreeMap()
.Name("treeMap")
.TextField("TitleTile")
.DataSource(dataSource =&gt; dataSource
.Read(read =&gt; read.Action("ActionName", "ControllerName"))
.Model(m =&gt; m.Children("Items"))
)
)

Sets the type of the Kendo UI theme of the TreeMap. Note: Starting with version Q2 2024, the default value for the Theme option is "sass" instead of "default". It is recommended to use "sass" with version Q2 2024 or later.

C#
public TreeMapBuilder Theme(string value)
Parameters:valuestring

The value that configures the theme.

Returns:

TreeMapBuilder

Example:
C#
@(Html.Kendo().TreeMap()
.Name("treeMap")
.Theme("sass")
)

Defines the type of the layout.

C#
public TreeMapBuilder Type(TreeMapType value)
Parameters:valueTreeMapType

The enum value that configures the type.

Returns:

TreeMapBuilder

Example:
C#
@(Html.Kendo().TreeMap()
.Name("treeMap")
.Type(TreeMapType.Horizontal)
)

Defines the data item field that contains the tile value.

C#
public TreeMapBuilder ValueField(string value)
Parameters:valuestring

The name of the Model property that holds the tile value.

Returns:

TreeMapBuilder

Example:
C#
@(Html.Kendo().TreeMap()
.Name("treeMap")
.ValueField("TileValue")
.DataSource(dataSource =&gt; dataSource
.Read(read =&gt; read.Action("ActionName", "ControllerName"))
.Model(m =&gt; m.Children("Items"))
)
)