New to Telerik UI for Blazor? Download Free 30-day trial
ContextMenu - Flat Data
- EXAMPLE
- VIEW SOURCE
- EDIT IN TELERIK REPL
- Change Theme
default
Right-click to open Context menu
- Flat-data.razor
Description
The Telerik UI for Blazor Context Menu component provides users with an easily accessible shortcut menu of frequently used commands.
One of the main ways to provide data to Context Menu is using flat data. The component rendering stays the same regardless of the data type. Yet, its configuration will be different when using flat or hierarchical data. The current demo targets data binding to flat data.
The flat data means that the entire collection of Context Menu items is available at one level, unlike when using hierarchical data. The parent-child relationships are created through internal data in the model - the ParentId
field which points to the Id
of the item that will contain the current item. The root level has null
for ParentId
.
The demo above demonstrates a Telerik Blazor Context Menu component that uses flat data. The parent-child relationship is created through the Parent
and Id
fields of the MenuItem
model.