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

VisualizationLayer SelectedItems

1 Answer 32 Views
Map
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 30 Apr 2014, 01:26 PM
Is it possible to bind SelectedItems on the VisualizationLayer?

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 05 May 2014, 06:32 AM
Hello John,

Yes, it is possible.
The sample code is below.
<Window x:Class="SelectedItemsBindingTest.MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <Grid x:Name="LayoutRoot">
        <telerik:RadMap x:Name="radMap"
                        MouseClickMode="SelectItem"
                        Center="50,20"
                        ZoomLevel="3">
            <telerik:RadMap.Provider>
                <telerik:OpenStreetMapProvider />
            </telerik:RadMap.Provider>
            <telerik:VisualizationLayer x:Name="layer"
                                        SelectedItems="{Binding SelectedItems}">
                <telerik:VisualizationLayer.SelectedFill>
                    <telerik:MapShapeFill Fill="#9f5f5f5f"
                                          Stroke="White" StrokeThickness="1" />
                </telerik:VisualizationLayer.SelectedFill>
                <telerik:VisualizationLayer.Reader>
                    <telerik:AsyncShapeFileReader Source="/SelectedItemsBindingTest;component/Resources/Europe.shp" />
                </telerik:VisualizationLayer.Reader>
            </telerik:VisualizationLayer>
        </telerik:RadMap>
    </Grid>
</Window>

using System.Collections.ObjectModel;
using System.Windows;
 
namespace SelectedItemsBindingTest
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
 
            this.SelectedItems = new ObservableCollection<object>();
            this.SelectedItems.CollectionChanged += SelectedItems_CollectionChanged;
            this.DataContext = this;
        }
 
        public ObservableCollection<object> SelectedItems
        {
            get;
            set;
        }
 
        private void SelectedItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
        }
    }
}

Regards,
Andrey Murzov
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Map
Asked by
John
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or