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.