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

Static Shapefiles and dynamic itemssource?

1 Answer 90 Views
Map
This is a migrated thread and some comments may be shown as answers.
Dirk Liebich
Top achievements
Rank 1
Dirk Liebich asked on 17 Aug 2011, 10:26 AM
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>

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 22 Aug 2011, 02:58 PM
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 >>

Tags
Map
Asked by
Dirk Liebich
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or