This question is locked. New answers and comments are not allowed.
Hi, I display some pushpins on the map, and when I "LeftMouseButtonDown" on either of them I show a popup.
I have the following code:
Code behind is:
The problem is that the "Pushpin_MouseLeftButtonDown" doesn't always get called. Sometimes it does, sometimes it doesn't.
I did notice thought that the "Grid_MouseLeftButtonDown" always gets called, but that doesn't help because I really need to have "Pushpin_MouseLeftButtonDown" always called.
Do you know how I could achieve this?
I have the following code:
<telerik:RadMap x:Name="radMap" Grid.Row="0" ZoomLevel="1" DistanceUnit="Kilometer" MouseClickMode="None" InitializeCompleted="radMap_InitializeCompleted"> <telerik:InformationLayer x:Name="informationLayer"> <telerik:InformationLayer.ItemTemplate> <DataTemplate> <Grid telerik:MapLayer.Location="{Binding Location}" MinWidth="250" MaxWidth="600" Height="100" Background="Transparent" MouseLeftButtonDown="Grid_MouseLeftButtonDown" > <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition /> </Grid.ColumnDefinitions> <telerik:Pushpin Grid.Row="1" HorizontalAlignment="Center" MouseLeftButtonDown="Pushpin_MouseLeftButtonDown"/> </Grid> </DataTemplate> </telerik:InformationLayer.ItemTemplate> </telerik:InformationLayer></telerik:RadMap>Code behind is:
public MainPage(){ InitializeComponent(); this.radMap.Provider = new BingMapProvider(MapMode.Road, true, "key"); ClosePopup.Click += new RoutedEventHandler(ClosePopup_Click);}void ClosePopup_Click(object sender, RoutedEventArgs e){ MyPopup.IsOpen = false;}private ObservableCollection<MapItem> GetMapData(){ ObservableCollection<MapItem> data = new ObservableCollection<MapItem>(); data.Add(new MapItem("Sofia", new Location(42.6957539183824, 23.3327663758679), 5, new ZoomRange(5, 12))); data.Add(new MapItem("Plovdiv", new Location(80.1429369264591, 24.7498095849434), 5, new ZoomRange(5, 12))); data.Add(new MapItem("Burgas", new Location(12.5131732087098, 27.4611884843576), 5, new ZoomRange(5, 12))); data.Add(new MapItem("Varna", new Location(80.2073941930888, 90.9275176988258), 5, new ZoomRange(5, 12))); data.Add(new MapItem("Varna", new Location(120.2073941930888, 10.9275176988258), 5, new ZoomRange(5, 12))); data.Add(new MapItem("Varna", new Location(1.2073941930888, 12.9275176988258), 5, new ZoomRange(5, 12))); data.Add(new MapItem("Sofia", new Location(42.6957539183824, 73.3327663758679), 5, new ZoomRange(5, 12))); data.Add(new MapItem("Sofia", new Location(100.6957539183824, 115.3327663758679), 5, new ZoomRange(5, 12))); data.Add(new MapItem("Sofia", new Location(100.6957539183824, 1.3327663758679), 5, new ZoomRange(5, 12))); return data;}private void Pushpin_MouseLeftButtonDown(object sender, MouseButtonEventArgs e){ MyPopup.IsOpen = true;}private void radMap_InitializeCompleted(object sender, EventArgs e){ this.informationLayer.ItemsSource = GetMapData();}private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e){ //MyPopup.IsOpen = true;}The problem is that the "Pushpin_MouseLeftButtonDown" doesn't always get called. Sometimes it does, sometimes it doesn't.
I did notice thought that the "Grid_MouseLeftButtonDown" always gets called, but that doesn't help because I really need to have "Pushpin_MouseLeftButtonDown" always called.
Do you know how I could achieve this?