We have a map layer datasource containing (in addition to the wkt) several string, integer and double properties, alongside with a property of type SeriesCollection.
The map layer has a ValueTemplate containing a WebChart, and the idea was to bind the datasource SeriesCollection property to the Series property of the chart. The other properties bind as expected and appear as tooltip, title, etc., but the SeriesCollection causes the following message when included in the DataMapping:
Invalid data mapping. Make sure the map column names match the database column names.
Changing the data series property to String for testing causes the binding to proceed without errors (but of course, that does not work for the chart).
Is there restrictions on the data types of properties that can be bound through DataMapping, and if so, how can we proceed to pass chart data series through the map layer and to the embedded chart control? The number of DataPoints in the series is unknown at design time.
Thanks, works like a charm.
Hi mio1963,
You can use SqlShapeReader's DataMapping to define a mapping between database and MapElement's regular and custom properties. Where the regular properties are those defined in MapElement class and the custom properties are those that don't exist in the MapElement class, but are stored internaly in a Dictionary-like structure. You can access the custom properties through MapElement's GetProperty and SetProperty methods. You can use the regular properties in data binding as usual, but you can't access the custom ones. And because of that a "BindingExpression path error" is thrown. The above applies to MapLayer's DataMapping as well. One way to workaround this limitation is to use Attached Properties to set custom data for each MapElement and bind to the attached property in your value template. Please take a look at those forum posts: http://community.infragistics.com/forums/p/43456/239043.aspx#239043, http://community.infragistics.com/forums/p/52090/271465.aspx#271465.
Please let me know if you have more questions.
Regards,
Ivan Kotev
There is more to this than I first was aware of. The map layer data source is a spatial database, and the features and their properties are read using a SqlShapeReader on the map layer. The features contain an arbitrary number of properties, like for instance population by gender or agegroup.
I was under the impression that we could use the DataMapping property of the SqlShapeReader to map these properties to the map layer, but I have obviously missed something along the way. Assume that each feature has the properties GeoWKT, DistrictName, TotPopulation, PopMale, PopFemale. I can then create a DataMapping like this; "Data=GeoWKT;Name=DistrictName;Value=TotPopulation". The features will draw perfectly, and I can access the properties Name and Value in a MapLayer.ValueTemplate DataTemplate to show them on each feature.
However, I would also like to present male and female population as well, and therefore added to DataMapping ";Males=PopMale;Females=PopFemale". But when I then try to access Males and Females in the DataTemplate I get error messages like this one:
System.Windows.Data Error: BindingExpression path error: 'Males' property not found on 'Infragistics.Controls.Maps.SurfaceElement'
How can I bind any number of feature properties to the map layer in order to access them in the DataTemplate?