We use the SqlGeospatialDataReader
, with the Source property set to an ObservableCollection of objects. Each object in that collection has a property named "WKT". We direct the reader to use our "WKT" property when we set the reader's GeospatialPropertyName property. The well known text in this case is of points.
My question deals with how to style the MapPinPoint objects which exist after the reader reads.
This is how we style the points now... we handle the reader's PreviewReadCompleted event, and in that handler, we pass the enumeration of MapPinPoint objects to our map view model. The view model then sets properties on the point, such as back color, fore color, height, width, balloon style, border brush, and border thickness.
It seems to me that this is a poor design. I would expect a style with bound properties could be defined in XAML. I experimented with the PointTemplate property of SqlGeospatialDataReader, but had no success. I searched the forum and found this thread, but it was little help to me.
I am mulling over the idea of using a Behavior
attached to the SqlGeospatialDataReader. I've had success with behaviors for other functionality (attached to RadMap), and it may be nice to use a behavior here. My idea is to have the behavior listen for the PreviewReadCompleted and then do the point style work that now occurs in our map view model.
My hope is that this post will elicit discussion of how to best style points (or other shapes) when one uses the SqlGeospatialDataReader in an InformationLayer.
I look forward to your comments,