This demo illustrates how to bind the DevExpress ASP.NET MVC Ribbon extension to a Model passed to a View from the Controller. The Bind method is used to bind a Ribbon to the Model. Note that the Ribbon extension can only be bound to hierarchal data sources, and as such, a Model object passed to the Bind method must support the IHierarchicalEnumerable interface. During binding, the ribbon automatically creates tabs, groups and items, and retrieves their property values from the corresponding data items.
The Ribbon extension ships with the following data binding methods:
Additionally, the Ribbon provides specific events related to data binding that can be handled according to your application logic.
- TabDataBound – allows you to customize the settings of an individual tab immediately after it is bound to data.
- GroupDataBound – allows you to customize the settings of an individual group immediately after it is bound to data.
- ItemDataBound – allows you to customize the settings of an individual item immediately after it is bound to data.
In this demo, the Ribbon is bound to an XML file by passing the path to the file and the required XPath to the BindToXML method. The tab, group, and item property values are obtained automatically because the data item attributes are named according to the corresponding default property values.
Local Copy of this Demo
To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer.
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
The source code files for this demo are installed (by default) in the following directory:
Open CS Solution
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxNavigationAndLayoutDemos