Visibility of labels and options

2 posts, 0 answers
  1. Robbe Morris
    Robbe Morris avatar
    25 posts
    Member since:
    Apr 2004

    Posted 28 Dec 2012 Link to this post

    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();
     
           }
  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 02 Jan 2013 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top