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

PanningFinished fires continously

1 Answer 39 Views
Map
This is a migrated thread and some comments may be shown as answers.
Rieni De Rijke
Top achievements
Rank 1
Rieni De Rijke asked on 13 Oct 2011, 11:43 AM
Is it possible that the RadMap.PanningFinished not only fires when the panning is finished?
In our application PanningFinished fires continously when you are panning (with the mouse)?

We have "SpringAnimation" set to "false"
The version we are using is: 2011.2.Sp1.Internal  2011.2.1010.40  Runtime Version: v4.0.30319


1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 18 Oct 2011, 08:34 AM
Hello Rieni De Rijke,

The event works as designed. It is based on the MotionFinished event of standard Silverlight MultiScaleImage control. Our own implementation of the MultiScaleImage for WPF raises the same event. So, they have a similar behavior.
If you want to handle event taking into account a case when the user drags map by mouse then you should handle the mouse button down / up events. The sample code is below.
private bool mouseDownOccurs;
private bool panningFinishedOccurs;
 
private void RadMap1_PanningFinished(object sender, RoutedEventArgs e)
{
    if (this.mouseDownOccurs)
    {
        // mouse down occurs
        // set flag for mouse button up event
        panningFinishedOccurs = true;
    }
    else
    {
        // PanningFinished occurs
        this.PanningFinishedLogic();
        this.panningFinishedOccurs = false;
    }
}
 
private void RadMap1_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
    RadMap radMap = sender as RadMap;
    if (radMap != null)
    {
        this.mouseDownOccurs = true;
        radMap.CaptureMouse();
    }
}
 
private void RadMap1_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
    RadMap radMap = sender as RadMap;
    if (radMap != null)
    {
        this.mouseDownOccurs = false;
        radMap.ReleaseMouseCapture();
 
        if (this.panningFinishedOccurs)
        {
            // PanningFinished occurs
            this.PanningFinishedLogic();
            this.panningFinishedOccurs = false;
        }
    }
}
 
private void PanningFinishedLogic()
{
    // ...
}

Greetings,
Andrey Murzov
the Telerik team

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

Tags
Map
Asked by
Rieni De Rijke
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or