radmap crash in two radwindow

2 posts, 0 answers
  1. Henri
    Henri avatar
    74 posts
    Member since:
    Aug 2008

    Posted 30 Sep 2010 Link to this post

    I am using the latest version (SL4) telerik v2010.2.924.1040. Given two radwindows with each a radmap.
    To perform crash , start the app, then drag map in left radwindow.
    (no click on map or on window, just start drag, if it does not crash, try a few times drag in left, drag in right.)
    Attached screenshot of crash.
    What am i doing wrong?

    The mainpage:
    <Grid x:Name="LayoutRoot">
            <telerik:RadWindow x:Name="w1" Width="320" Height="320" >
                <Controls:RadMap x:Name="map1" ZoomLevel="4" ></Controls:RadMap>         
            </telerik:RadWindow>
            <telerik:RadWindow x:Name="w2"  Width="320" Height="320" Left="330">
                <Controls:RadMap x:Name="map2" ZoomLevel="4" ></Controls:RadMap>
            </telerik:RadWindow>
     </Grid>

    and codebehind

    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            this.Loaded +=new RoutedEventHandler(MainPage_Loaded);
        }
        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            map1.Provider = new OpenStreetMapProvider(); 
            map1.Center = new Location(0.0, 0.0);
            map2.Provider = new OpenStreetMapProvider();
            map2.Center = new Location(0.0, 0.0);
            w1.Show();
            w2.Show();
        }

    I guess it has something to do with the focus...

    Thanks.
    Henri
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 04 Oct 2010 Link to this post

    Hi Henri,

    Thank you for the feedback.
    We have reproduced the problem.
    When you start to drag a map in the RadWindow and it is not activated (focused) then it activates and refreshes its content (RadMap). During this process the size of the map control is empty. At this moment the RadMap calculates its Center property incorrectly and it crashes.

    We've created a PITS issue to fix this problem in future releases.
    You can track its implementation by the following link:
    http://www.telerik.com/support/pits.aspx#/public/silverlight/3625

    As workaround you can handle the mouse move event to enable or disable the mouse drag mode for the map control.
    The sample code is below.

    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        
        
    void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            map1.Provider = new OpenStreetMapProvider();
            map1.Center = new Location(0.0, 0.0);
            map2.Provider = new OpenStreetMapProvider();
            map2.Center = new Location(0.0, 0.0);
            w1.Show();
            w2.Show();
            map1.MouseMove += new MouseEventHandler(map1_MouseMove);
            map2.MouseMove += new MouseEventHandler(map2_MouseMove);
        }
        private void map1_MouseMove(object sender, MouseEventArgs e)
        {
            if (map1.ActualWidth > 0 && w1.IsActiveWindow)
            {
                map1.MouseDragMode = MouseDragBehavior.Drag;
            }
            else
            {
                map1.MouseDragMode = MouseDragBehavior.None;
            }
        }
        private void map2_MouseMove(object sender, MouseEventArgs e)
        {
            if (map2.ActualWidth > 0 && w2.IsActiveWindow)
            {
                map2.MouseDragMode = MouseDragBehavior.Drag;
            }
            else
            {
                map2.MouseDragMode = MouseDragBehavior.None;
            }
        }
    }

    Greetings,
    Andrey Murzov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
Back to Top