Move a MapEllipse by drap And drop

2 posts, 0 answers
  1. Gauthier
    Gauthier avatar
    3 posts
    Member since:
    Sep 2013

    Posted 05 Dec 2013 Link to this post

    Hi,

    I have to show some 'POIs' on a map.
    The POIs collection is bound using a typical MVVM approach.
    Once the map is loaded, a 'best fit' must be applied to see all the POIs as closely as possible.
    Finally, I must be able to change the location of the POIs by using drap and drop.

    In my first attempt, I used MapPinPoint as elements for the POIs.
    The 'move' operation was working fine, but unfortunately the GetBestView gave strange results.
    (In fact I had to call it several times in order to really get the best view)
    Here is the xaml for the pin point :

            <DataTemplate x:Key="ObstructionPointItemTemplate" DataType="mapLayers:ObstructionPointViewModel">
                <telerik:MapPinPoint                                        
                                            telerik:MapLayer.Location="{Binding Path=Location}"                                        
                                            ToolTip="{Binding Label}"
                                            >
                    <i:Interaction.Behaviors>
                        <behaviors:PointBehavior/> <!--This behavior allows the drap and drop move-->
                    </i:Interaction.Behaviors>
                </telerik:MapPinPoint>
            </DataTemplate>
    


    Based on the decompiled code, I assumed my issue with 'GetBestView' was due to the fact that MapPinPoint wasn't a 'MapShape'
    Thus, I decide to give it a chance with 'MapEllipse' :

            <DataTemplate x:Key="ObstructionPointItemTemplate" DataType="mapLayers:ObstructionPointViewModel">
                <telerik:MapEllipse Width="0.1"
                                            Height="0.1"
                                            telerik:MapLayer.Location="{Binding Path=Location}"
                                            Fill="{StaticResource PointFill}"                                        
                                            ToolTip="{Binding Label}"
                                            Stroke="{StaticResource ObstructionPointColor}"                                      
                                            StrokeThickness="2"                                
                                            >
                </telerik:MapEllipse>
            </DataTemplate>
    

    Then the 'GetBestView()' just works fine, but unfortunately, I'm don't know how I can nicely implements the 'drag and drop' feture for MapShape.


    Can you please provide some help ?

    Thx
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 10 Dec 2013 Link to this post

    Hi Gauthier,


    First of all, in the Q2 2013 release we've introduced new visualization engine in the RadMap. It has been designed from scratch to have better performance. The new engine is based on the VisualizationLayer class. I would recommend you to give it a try. You can find documentation and examples of the new layer here:

    RadMap Visualization Layer Introduction
    RadMap DataBinding Demo
    RadMap ClusterVirtualization Demo

    The VisualizationLayer also contains the GetBestView method and it should work correct in your case.

    Unfortunately the MapShapes do not support behaviors. So you should implement 'drag and drop' using mouse events.


    Regards,

    Andrey Murzov

    Telerik

    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.

    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top