How to change balloon color and get tooltip info.

4 posts, 1 answers
  1. Rod Yager
    Rod Yager avatar
    79 posts
    Member since:
    May 2010

    Posted 03 Nov 2010 Link to this post

    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()
            {
            }
        }
  2. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 09 Nov 2010 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Rod Yager
    Rod Yager avatar
    79 posts
    Member since:
    May 2010

    Posted 10 Nov 2010 Link to this post

    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

  5. Rod Yager
    Rod Yager avatar
    79 posts
    Member since:
    May 2010

    Posted 10 Nov 2010 Link to this post

    Nevermind. I figured it out.

     

    Pushpin

     

     

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

     

     

     

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

     



    Rod
Back to Top