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

How to change balloon color and get tooltip info.

3 Answers 213 Views
Map
This is a migrated thread and some comments may be shown as answers.
Rod Yager
Top achievements
Rank 1
Rod Yager asked on 03 Nov 2010, 07:34 PM
I have an ObservableCollection of POI's that I bind to an InformationLayer. The results are that I get a bunch of silver balloons with a red dot in the middle. How can I control the color inside the balloon? This would be great to color code my balloon by priority. Also, how can I get a tooltip to display stuff like the address, misc text, etc?

poiInformationLayer.DataMappings.Add(new DataMapping("Location", DataMember.Location));
              
            //Bind POI collection to the poi layer.
            Binding binding = new Binding();
            binding.Source = poiCollection;
            this.poiInformationLayer.SetBinding(ItemsControl.ItemsSourceProperty, binding);

public class PointOfInterest
    {
        private Location _location;
        private ZoomRange _zoomRange;
        private double _baseZoomLevel;
        private string _title;
        private string _imageUri;
        private string _description;
  
        public Location Location
        {
            get
            {
                return _location;
            }
            set
            {
                _location = value;
            }
        }
  
        public ZoomRange ZoomRange
        {
            get
            {
                return _zoomRange;
            }
            set
            {
                _zoomRange = value;
            }
        }
  
        public double BaseZoomLevel
        {
            get
            {
                return _baseZoomLevel;
            }
            set
            {
                _baseZoomLevel = value;
            }
        }
  
        public string Title
        {
            get
            {
                return _title;
            }
            set
            {
                _title = value;
            }
        }
  
        public string ImageUri
        {
            get
            {
                return _imageUri;
            }
            set
            {
                _imageUri = value;
            }
        }
  
        public string Description
        {
            get
            {
                return _description;
            }
            set
            {
                _description = value;
            }
        }
  
    }
  
    public class POICollection : ObservableCollection<PointOfInterest>
    {
        public POICollection()
        {
        }
    }

3 Answers, 1 is accepted

Sort by
0
Accepted
Andrey
Telerik team
answered on 09 Nov 2010, 09:37 AM
Hello Rod Yager,

You can change the color inside the balloon using binding to the Background property.
I have attached a sample solution. I have used the item template which uses binding to the Location, Background and ToolTip properties.
I hope it helps.

Best wishes,
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
0
Rod Yager
Top achievements
Rank 1
answered on 10 Nov 2010, 02:55 PM

Thanks Andrey that worked. One more question. I have added ContextMenu off of the pushpin and am trying to get the location of the pushpin now with no luck. Do you have any sample code that allows you to bring up a menu or click on a pushpin to get details about it? ie location's lat/long.

<DataTemplate x:Key="MapPushpinTemplate">
        <telerik:Pushpin telerik:MapLayer.Location="{Binding Location}" Background="{Binding Background}" ToolTip="{Binding Title}" ContextMenu="{Binding Menu}"/>        
    </DataTemplate>


Thanks,
Rod

0
Rod Yager
Top achievements
Rank 1
answered on 10 Nov 2010, 07:33 PM

Nevermind. I figured it out.

 

Pushpin

 

 

pp = ((ContextMenu)(mi.Parent)).PlacementTarget as Pushpin;

 

 

 

Location loc = ((Location)(pp.GetValue(MapLayer.LocationProperty)));

 



Rod
Tags
Map
Asked by
Rod Yager
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Rod Yager
Top achievements
Rank 1
Share this question
or