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

VisualizationLayer, Location.Empty, and updating

1 Answer 126 Views
Map
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 31 Aug 2015, 08:18 PM

I'd like to use the VisualizationLayer, in a geocoding application situation.  We start with a number of data objects that do not have lat/long data, then add that data, and ideally animate them as they appear on the map. 

These data objects are in an observable collection, and are represented with the following data template:

 

<DataTemplate x:Key="MyDataModelTemplate" DataType="{x:Type models:MyDataModel}">
            <Viewbox x:Name="PART_Shape"
                     HorizontalAlignment="Stretch"
                     VerticalAlignment="Stretch">
                <telerik:MapLayer.Location>
                    <MultiBinding Converter="{StaticResource LatitudeLongitudeToLocationMultiConverter}">
                        <Binding Path="Latitude"/>
                        <Binding Path="Longitude"/>
                    </MultiBinding>
                </telerik:MapLayer.Location>
                <telerik:MapLayer.HotSpot>
                    <telerik:HotSpot X="0.5" Y="0.5"/>
                </telerik:MapLayer.HotSpot>
                <Ellipse Fill="DodgerBlue"
                         Width="15"
                         Height="15"
                         StrokeThickness="1"
                         Stroke="Black"
                         ToolTip="{Binding DisplayName}">
                </Ellipse>
            </Viewbox>
        </DataTemplate>

The converter returns Location.Empty when the latitude ​or longitude are null (they are nullable doubles), otherwise it just returns the Telerik Location object that correspondes to those properties.

 

Here's my problem:

When a location moves from a valid location to another valid location, the ellipse moves accordingly based on the above binding.  But when a location changes from Location.Empty to a valid location, it does not immediately appear.  The user must change zoom levels in order for the location to appear.

Is this a bug in the RadMap control or am I doing something wrong? 

 

Thank you,

Alan

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 03 Sep 2015, 08:48 AM
Hello Alan,

We are aware of this behavior in RadMap, you can consider this operation as not completely supported currently. However, there are two approaches you can use:

- When you change the Location from Empty to non-empty, invoke in the code behind Visualizationlayer.ArrangeItem() method
- In the ViewModel class - if you have such, you can implement the   Telerik.Windows.Controls.Map.INotifyLocationChanged interface like so:
public class MapItem : INotifyPropertyChanged, INotifyLocationChanged
...

public
Location Location
        {
            get
            {
                return this.location;
            }
 
            set
            {
                Location oldValue = this.location;
                this.location = value;
                this.OnPropertyChanged("Location");
                if (this.LocationChanged != null)
                {
                    this.LocationChanged(this, new LocationChangedEventArgs(oldValue, this.location));
                }
            }
        }


Regards,
Petar Mladenov
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Map
Asked by
Alan
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or