Static Shapefiles and dynamic itemssource?

2 posts, 0 answers
  1. Dirk Liebich
    Dirk Liebich avatar
    17 posts
    Member since:
    Jun 2010

    Posted 17 Aug 2011 Link to this post

    Guys,

    I have the following xaml below and bind my POI's ect via the ItemsSource Binding on the information layer. The information layer itself gets its shapedata by once static source for Asia.

    Once I run the application I get the following exception:
    Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead.

    Is there any workaround you could offer in order to bind my map elements/POI's using the itemssource AND have the MapShapes configured in the XAML? I'd like to use as much MVVM I can and therefor I'd like to use data binding to my viewmodel.

    Thanks,

    XAML:

     
       <telerik:RadMap x:Name="radMap" CommandBarVisibility="Visible" IsTextSearchEnabled="False">
                <telerik:RadMap.Provider>
                    <telerik:EmptyProvider/>
                </telerik:RadMap.Provider>
                
            <telerik:InformationLayer x:Name="informationLayer" ItemsSource="{Binding MapData}">
            
                
                               
                    <telerik:InformationLayer.Reader>
                        <telerik:MapShapeReader DataSource="/DTClientServices.PlanningSuite.Views;component/Shapefiles/Asia/asia.dbf" Source="/DTClientServices.PlanningSuite.Views;component/Shapefiles/Asia/asia.shp" ClearLayer="False" />
                    </telerik:InformationLayer.Reader>
                    
           
                    <telerik:InformationLayer.ItemTemplate>
                        <DataTemplate>
                            <Grid telerik:MapLayer.BaseZoomLevel="{Binding BaseZoomLevel}"
                           telerik:MapLayer.Location="{Binding Location}"
                           telerik:MapLayer.ZoomRange="{Binding ZoomRange}">
                                <telerik:MapLayer.HotSpot>
                                    <telerik:HotSpot X="0.5"
                                               Y="0.5"
                                               ElementName="PART_Ellipse" />
                                </telerik:MapLayer.HotSpot>
                                <Ellipse x:Name="PART_Ellipse"
                                   Width="20"
                                   Height="20"
                                   Stroke="Red"
                                   StrokeThickness="3"
                                   Fill="Transparent">
                                    <ToolTipService.ToolTip>
                                        <ToolTip Content="{Binding Caption}" />
                                    </ToolTipService.ToolTip>
                                </Ellipse>
                            </Grid>
                        </DataTemplate>
                    </telerik:InformationLayer.ItemTemplate>
                </telerik:InformationLayer>
            </telerik:RadMap>
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 22 Aug 2011 Link to this post

    Hello Dirk,

    You can use 2 information layers. The first one will show map shapes from the shape file. The second one will show POIs from your data collection.

    Greetings,
    Andrey Murzov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top