VisualizationLayer issues with location and listcollectionview

2 posts, 0 answers
  1. Vladimír
    Vladimír avatar
    4 posts
    Member since:
    Feb 2013

    Posted 29 Jan 2014 Link to this post

    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?
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 03 Feb 2014 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top