This question is locked. New answers and comments are not allowed.
Hi,
I'm trying to get the ItemTemplateSelector of the InformationLayer to work, and am not succeeding.
Initially I tried creating my layers dynamically in code as I needed them, but even when trying this other ways it does not seem to work.
My template is (I will write more once I get this working)
My map definition is:
My CodeBehind:
The data context I set contains the FilteredItems property.
Please enlighten me
Thanks
Yaron
I'm trying to get the ItemTemplateSelector of the InformationLayer to work, and am not succeeding.
Initially I tried creating my layers dynamically in code as I needed them, but even when trying this other ways it does not seem to work.
My template is (I will write more once I get this working)
<DataTemplate x:Key="MapItemDataTemplate"> <TextBlock Text="Hi" telerikMap:MapLayer.Location="{Binding Location}" telerikMap:MapLayer.BaseZoomLevel="{Binding BaseZoomLevel}" telerikMap:MapLayer.ZoomRange="{Binding ZoomRange}" /> </DataTemplate>
<telerikDataVis:RadMap x:Name="mapView" ZoomLevel="{Binding Zoom, Mode=TwoWay}" Center="{Binding Center, Mode=TwoWay}"
CenterChanged="LocationRectChangedHandler" ZoomChanged="LocationRectChangedHandler"
InitializeCompleted="mapView_InitializeCompleted"
MouseLeftButtonDown="mapView_MouseLeftButtonDown"
d:IsHidden="True">
<telerikMap:InformationLayer x:Name="InformationLayer1" Visibility="Collapsed"
ItemsSource="{Binding FilteredItems}" />
</telerikDataVis:RadMap>
My CodeBehind:
public MapView() { InitializeComponent(); // binding for DataContext (see note on InternalDataContextProperty) SetBinding(InternalDataContextProperty, new Binding()); // set provider for maps this.mapView.Provider = new Telerik.Windows.Controls.Map.OpenStreetMapProvider(); this.InformationLayer1.ItemTemplateSelector = new MyMapDataTemplateSelector() { mapView = this }; } private void mapView_InitializeCompleted(object sender, EventArgs e) { this.InformationLayer1.DataContext = (DataContext as IMapViewModel).GetLayer("main"); this.InformationLayer1.Visibility = Visibility.Visible; }The data context I set contains the FilteredItems property.
Please enlighten me
Thanks
Yaron