Creating xamDataPresenter in XAML

Glossary Item Box

Infragistics(R) NetAdvantage(R) for WPF

Creating xamDataPresenter in XAML

When you first start working with a new control, you may not know where to begin. This topic will walk you through, from the beginning, how to create the xamDataPresenter™ control and data bind it using XAML. For information on creating the xamDataPresenter control in procedural code, see Creating xamDataPresenter in Procedural Code.

  1. Create a Microsoft® Windows® Presentation Foundation Window or Page project.
  2. For easier access to xamDataPresenter, place the following namespace declaration inside the opening Page or Window tag.

    In XAML:

    xmlns:igDP="http://infragistics.com/DataPresenter"
    

  3. Create a resources section defining an XmlDataProvider. The XmlDataProvider references the Orders XML file. Place the following XAML inside the Grid Panel. 

    In XAML:

    <Grid.Resources>
    	<XmlDataProvider Source="../Data/Orders.xml" 
    	  x:Key="OrderData" XPath="/Orders" />
    </Grid.Resources>
    

  4. Create an instance of XamDataPresenter, name it, and set its DataSource to the XmlDataProvider you created in the previous step. Set the xamDataPresenter's View property to GridView.

    In XAML:

    <igDP:XamDataPresenter x:Name="XamDataPresenter1"  
      DataSource="{Binding Source={StaticResource OrderData}, XPath=Order}">
    	<igDP:XamDataPresenter.View>
    		<igDP:GridView/>
    	</igDP:XamDataPresenter.View>
    </igDP:XamDataPresenter>
    

  5. Build and run the project. You should see the xamDataPresenter control populated with data similar to the image below.
Related Topics

Binding to a Flat SQL Database

Binding to a Hierarchical SQL Database

Binding to an ObervableCollection

Using the Data Context for Data Binding


E-mail your feedback on this topic.

Opinion about our help? Take our survey.

Copyright © 2003-2007 Infragistics, Inc. All rights reserved.

Build Version: 7.1.20071.1320