VisualizationLayer SelectedItems

2 posts, 0 answers
  1. John
    John avatar
    7 posts
    Member since:
    Apr 2014

    Posted 30 Apr 2014 Link to this post

    Is it possible to bind SelectedItems on the VisualizationLayer?
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 05 May 2014 Link to this post

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