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

Visibility of labels and options

1 Answer 161 Views
Map
This is a migrated thread and some comments may be shown as answers.
Robbe Morris
Top achievements
Rank 1
Robbe Morris asked on 28 Dec 2012, 08:27 PM
I'm attempting to wire up some functionality that will hide all of the user interface tools such as navigation, labels, zoom, and lat/lng with a button click.  Essentially, I'd call the method below to hide everything, then perform some functionality in my button click event, and then call this method again to show the user interface tools.

What happens is that the RadMap hasn't actually completed the update to the control prior to the code in "Do some stuff" executing.  I've noticed a small delay in the map rendering when the labels are turned on and off.  It "appears" that I need to figure out how to wait for the RadMap to complete its rerendering after SetMapLabels(false) prior to executing the "Do some stuff" code.

Am I correct in my assumption?  If so, can you share some insight as to which event handler would get triggered in this scenario?

private void btnDoStuff_Click(object sender, RoutedEventArgs e)
{
  SetMapLabels(false);
  // Do some stuff
  SetMapLabels(true);
}


private void SetMapLabels(bool on)
       {
           if (on)
           {
               _provider.IsLabelVisible = true;
               //   this.RadMap1.UseDefaultLayout = true;
               this.RadMap1.CommandBarVisibility = System.Windows.Visibility.Visible;
               this.RadMap1.NavigationVisibility = System.Windows.Visibility.Visible;
               this.RadMap1.ScaleVisibility = System.Windows.Visibility.Visible;
               this.RadMap1.ZoomBarPresetsVisibility = System.Windows.Visibility.Visible;
               this.RadMap1.ZoomBarVisibility = System.Windows.Visibility.Visible;
               this.RadMap1.MouseLocationIndicatorVisibility = System.Windows.Visibility.Visible;
               this.RadMap1.MiniMapExpanderVisibility = System.Windows.Visibility.Hidden;
               this.RadMap1.InvalidateVisual();
               this.RadMap1.UpdateLayout();
               return;
           }
 
 
           _provider.IsLabelVisible = false;
           //   this.RadMap1.UseDefaultLayout = false;
           this.RadMap1.CommandBarVisibility = System.Windows.Visibility.Hidden;
           this.RadMap1.NavigationVisibility = System.Windows.Visibility.Hidden;
           this.RadMap1.ZoomBarPresetsVisibility = System.Windows.Visibility.Hidden;
           this.RadMap1.ZoomBarVisibility = System.Windows.Visibility.Hidden;
           this.RadMap1.ScaleVisibility = System.Windows.Visibility.Hidden;
           this.RadMap1.MouseLocationIndicatorVisibility = System.Windows.Visibility.Hidden;
           this.RadMap1.MiniMapExpanderVisibility = System.Windows.Visibility.Hidden;
           this.RadMap1.InvalidateVisual();
           this.RadMap1.UpdateLayout();
 
       }

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 02 Jan 2013, 02:20 PM
Hello Robbe Morris,

This problem is not specific to RadMap and is actually expected behavior. You can test with a simple Button control - change the Background of the Button control, for example.

Basically, in this case, you can use the Dispatcher that the map is associated with, in order to execute your code when the map is updated. You can find additional information on the NET. Bellow I listed a couple of online resource that discuss the topic and I think will be of help to you:

Kind regards,
Tsvetie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Map
Asked by
Robbe Morris
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or