Back to Devexpress

DataSourceAdapterBase.DataSource Property

wpf-devexpress-dot-xpf-dot-map-dot-datasourceadapterbase.md

latest3.4 KB
Original Source

DataSourceAdapterBase.DataSource Property

Specifies the data source to provide data for a data adapter.

Namespace : DevExpress.Xpf.Map

Assembly : DevExpress.Xpf.Map.v25.2.dll

NuGet Package : DevExpress.Wpf.Map

Declaration

csharp
public object DataSource { get; set; }
vb
Public Property DataSource As Object

Property Value

TypeDescription
Object

A Object.

|

Example

This example shows how to use the ListSourceDataAdapter to load shipwreck information from an XML file and display wrecked ship images on a map.

  1. Create a ListSourceDataAdapter object and assign it to the VectorLayer.Data property.
  2. Specify the DataSourceAdapterBase.DataSource property.
  3. Configure the ListSourceDataAdapter.Mappings property to assign data source field values to map items.
  4. Use the ListSourceDataAdapter.ItemSettings property to specify map item settings.
csharp
<dxm:VectorLayer.Data>
    <dxm:ListSourceDataAdapter DataSource="{Binding Source={StaticResource data}, XPath=Ship}">
        <dxm:ListSourceDataAdapter.AttributeMappings>
            <dxm:MapItemAttributeMapping Name="Name" Member="Name"/>
            <dxm:MapItemAttributeMapping Name="Year" Member="Year"/>
            <dxm:MapItemAttributeMapping Name="Description" Member="Description"/>
        </dxm:ListSourceDataAdapter.AttributeMappings>
        <dxm:ListSourceDataAdapter.Mappings>
            <dxm:MapItemMappingInfo Latitude="Latitude" Longitude="Longitude"/>
        </dxm:ListSourceDataAdapter.Mappings>
        <dxm:ListSourceDataAdapter.ItemSettings>
            <dxm:MapCustomElementSettings ContentTemplate="{Binding Source={StaticResource itemTemplate}}"/>
        </dxm:ListSourceDataAdapter.ItemSettings>
    </dxm:ListSourceDataAdapter>
</dxm:VectorLayer.Data>

The structure of the XML file used in the example looks as follows:

Show XML

xml
<?xml version="1.0" standalone="yes"?>
<Ships>
  <Ship>
    <Year>1898</Year>
    <Name>Koonya</Name>
    <Description>A steamboat that ran aground off Cronulla Beach.</Description>
    <Latitude>-34.042876</Latitude>
    <Longitude>151.206777</Longitude>
  </Ship>
  <Ship>
    <Year>1809</Year>
    <Name>Hazard</Name>
    <Description>A sloop that ran aground on Box Head.</Description>
    <Latitude>-33.54227</Latitude>
    <Longitude>151.3485</Longitude>
  </Ship>  
  <!--...-->
</Ships>

See Also

DataSourceAdapterBase Class

DataSourceAdapterBase Members

DevExpress.Xpf.Map Namespace