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

VisualizationLayer issues with location and listcollectionview

1 Answer 81 Views
Map
This is a migrated thread and some comments may be shown as answers.
Vladimír
Top achievements
Rank 1
Vladimír asked on 29 Jan 2014, 02:54 PM
Hello!

I'm trying to implement map control and I use VisualizationLayer, but I have some issues with that...

1. I would like to filter some items which I want to display on the map but when I try to use ListCollectionView I get error "'System.Windows.Data.ListCollectionView' is not a valid value for property 'Source'.". Do you have any ideas why is this happening?
ListCollectionView for InformationLayer works great.

2. In my solution I had to use custom class which implements IMapPropertyAccessor interface but the problem is when I want to update "Location" on the fly, I don't know how to propagate this change to the user interface.
Do you have any suggestion how to do this?

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 03 Feb 2014, 01:02 PM

Hi Vladimír,

1. The InformationLayer inherits the ItemsControl, but the VisualizationLayer just emulates its functionality. Unfortunately, it does not allow to use the ListCollectionView as its items source. I have logged this issue on our feedback portal. You can track the implementation of this feature here.

2. The Property Accessor allows to map properties like the "Location" from the data item as a way to speed up accessing to it. But in order to update location of item dynamically you also should use binding of MapLayer.Location property in your data template.

The sample code is below.

public class DataItem : INotifyPropertyChanged
{
    private Location location;
    public Location Location
    {
        get
        {
            return this.location;
        }
        set
        {
            this.location = value;
            this.NotifyPropertyChanged("Location");
        }
    }
 
    public event PropertyChangedEventHandler PropertyChanged;
 
    private void NotifyPropertyChanged(string propName)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(propName));
        }
    }
}
<telerik:VisualizationLayer x:Name="visualizationLayer">
    <telerik:VisualizationLayer.ItemTemplate>
        <DataTemplate>
            <Ellipse telerik:MapLayer.Location="{Binding Location}" Fill="Blue" Width="15" Height="15" />
        </DataTemplate>
    </telerik:VisualizationLayer.ItemTemplate>
</telerik:VisualizationLayer>


Regards,
Andrey Murzov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.

Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.

Sign up for Free application insights >>
Ola
Top achievements
Rank 1
commented on 02 Jun 2022, 11:08 PM

See that there is still no fix for collection views as source on VisualizationLayer. What is the best option if I want to filter some locations in my source collection?
Martin Ivanov
Telerik team
commented on 07 Jun 2022, 01:41 PM

To achieve this, you can filter your data, add the remaining items in a new collection and then pass it to the ItemsSource of VisualizationLayer.
Tags
Map
Asked by
Vladimír
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or