Show theme settings Shopping cart Download trialFree Trial
Change Theme Settings
Change Theme Settings
Themes
 
Show All Themes
v
...v

Data Binding to XML

v


This demo illustrates how the BindToXML method can be used to easily populate the DevExpress MVC Navigation Bar with group and item information taken from an xml file. The xml file has the following structure:

<Cameras>
    <Brand Text="...">
        <Camera Model="..." Pixels="..." NavigateUrl="..." ImageUrl="..." />
        ...
    </Brand>
    ...
</Cameras>

The MVC NavBar is able to automatically retrieve group and item information by binding to data fields whose names coincide with property names of a group and item objects (such as the Text, NavigateUrl, ImageUrl and ToolTip). In this demo, the group text, and both the navigation location and image path of items are obtained automatically from the corresponding attributes of data source nodes. The texts used for individual items are composed dynamically by concatenating the values of the Model and Pixels attributes. This processing is performed within a delegate of the ItemDataBound method, which allows you to manipulate values being assigned to the properties of a NavBar item during data binding.

Collapse/Expand
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).
Open CS Solution
The source code files for this demo are installed (by default) in the following directory:
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxNavigationAndLayoutDemos