Bind To Image Data Source

3 posts, 1 answers
  1. Sean
    Sean avatar
    10 posts
    Member since:
    Aug 2011

    Posted 11 Aug 2011 Link to this post

    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. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 12 Aug 2011 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Sean
    Sean avatar
    10 posts
    Member since:
    Aug 2011

    Posted 12 Aug 2011 Link to this post

    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.
Back to Top