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

Using pin.ToolTipText with Bing!

2 Answers 80 Views
Map
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 30 Nov 2016, 04:08 PM

I have a string that contains the name of a person associated with a location.  I am using the request code provided by Telerik:

                Telerik.WinControls.UI.Map.Bing.SearchRequest request = new SearchRequest();
                request.Query = latlong;
                request.SearchOptions.QueryParse = true;
                request.UserData = //  <- Here is where I think it would work, but I don't know how to get this accessible by the Bing! search.                bingProvider.SearchAsync(request)

I am using the BingProvider_SearchCompleted code provided by Telerik, however, I do not see how to pass a string using the request that can then be used as the pin.ToolTipText. 

 

            Telerik.WinControls.UI.Map.RectangleG allPoints = new Telerik.WinControls.UI.Map.RectangleG(double.MinValue, double.MaxValue, double.MaxValue, double.MinValue);
            foreach (Telerik.WinControls.UI.Map.Bing.Location location in e.Locations)
            {
                Telerik.WinControls.UI.Map.PointG point = new Telerik.WinControls.UI.Map.PointG(location.Point.Coordinates[0], location.Point.Coordinates[1]);
                MapPin pin = new MapPin(point);
                pin.Size = new System.Drawing.Size(20, 40);
                pin.BackColor = Color.Aquamarine;
                pin.ToolTipText = //  <-  Here is where I would like the name to show up.
                this.radMap1.MapElement.Layers["Primary"].Add(pin);
                allPoints.North = Math.Max(allPoints.North, point.Latitude);
                allPoints.South = Math.Min(allPoints.South, point.Latitude);
                allPoints.West = Math.Min(allPoints.West, point.Longitude);
                allPoints.East = Math.Max(allPoints.East, point.Longitude);
                currentClientLoc = currentClientLoc + 1;
            }
            if (e.Locations.Length > 0)
            {
                if (e.Locations.Length == 1)
                {
                    this.radMap1.BringIntoView(new Telerik.WinControls.UI.Map.PointG(e.Locations[0].Point.Coordinates[0], e.Locations[0].Point.Coordinates[1]));
                }
                else
                {
                    this.radMap1.MapElement.BringIntoView(allPoints);
                    this.radMap1.Zoom(this.radMap1.MapElement.ZoomLevel - 1);
                }
            }
            else
            {
                RadMessageBox.Show("No result found for the provided search query!");
            } 

Any help would be much appreciated.  And...  I a side note.  I get to the first person to post on this forum?  Yay!  :-)

 

-Scott

2 Answers, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 01 Dec 2016, 04:46 PM
Hi Scott,

Thank you for writing.

Indeed, the described approach should be the proper way to achieving your task. This, however, is currently not supported. I have logged a request on our feedback portal and I have also cast a vote for it on your behalf. Additionally, you can subscribe to the item and be updated with all of its status changes here: 
FIX. RadMap - the ElevationRequest, and RouteRequest should work with their UserData property to allow passing of unique data which can be accessed upon completion of the request. Your Telerik points are also updated accordingly.

The issue is already in development and a fix will be available with our next official release scheduled for the end of January. For the time being you need to store locally the variable you would like to use as a tooltip.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik by Progress
Telerik UI for WinForms is ready for Visual Studio 2017 RC! Learn more.
0
Scott
Top achievements
Rank 1
answered on 02 Dec 2016, 01:08 PM
Thank you, Hristo.
Tags
Map
Asked by
Scott
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Scott
Top achievements
Rank 1
Share this question
or