This is a migrated thread and some comments may be shown as answers.

Bind To Image Data Source

2 Answers 91 Views
Map
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 1
Sean asked on 11 Aug 2011, 08:52 PM
I'm attempting to conform to the MVVM paradigm for my project. I'm already binding to a LocationCollection, which I use to plot points for a polygon on the map. This is working fine using the following:

<telerik:InformationLayer Name="informationLayer">
    <telerik:MapPolygon Points="{Binding MyPolygon}" />
</telerik:InformationLayer>


I'd like to add additional information in the form of images that are dragged and dropped onto the map. I have no problem manually adding images using the following in the code behind:

RadMap map = (RadMap)e.Options.Destination;
Location dropCursorLocation = Location.GetCoordinates(map, e.Options.RelativeDragPoint);
Image img = new Image { Source = new BitmapImage(new Uri(@"..\Resources\MyImage.png", UriKind.Relative)) };
 
MapLayer.SetLocation(img, dropCursorLocation);
informationLayer.Items.Add(img);

I'm fine with everything in the view model up until I add the image to the information layer. The MapPolygon typed works well for my polygon, but what should I use for my images? Should I add another type under the InformationLayer section? If so, which type should I use?

2 Answers, 1 is accepted

Sort by
0
Accepted
Andrey
Telerik team
answered on 12 Aug 2011, 04:21 PM
Hi Sean,

The information layer is an items control. So standard binding and templating features work for it. I would recommend you to take a look into the following sample in our demo application:

http://demos.telerik.com/silverlight/#Map/DataBinding

All the best,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Sean
Top achievements
Rank 1
answered on 12 Aug 2011, 05:39 PM
Thank you for the reply. I was actually close. I didn't realize you could have multiple information layers, which was necessary for my task.
Tags
Map
Asked by
Sean
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Sean
Top achievements
Rank 1
Share this question
or