wpf bing map Pushpin polymerization
How to achieve point aggregation?
如何实现Pushpin 聚合。
wpf bing map Pushpin polymerization
How to achieve point aggregation?
如何实现Pushpin 聚合。
Do you want to get the collection of Pushpin? How did you add Pushpin? I will show you my demo of getting collection of Pushpin, and if it doesn't help you, please let me. I use ObservableCollection<Pushpin> Pushpins to store the Pushpin.
int counter = 0;
ObservableCollection<Pushpin> Pushpins = new ObservableCollection<Pushpin>();
public MainWindow()
{
InitializeComponent();
myMap.MouseDoubleClick += new MouseButtonEventHandler(myMap_MouseDoubleClick);
}
private void myMap_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
e.Handled = true;
Point mousePosition = e.GetPosition(this);
Location pinLocation = myMap.ViewportPointToLocation(mousePosition);
Pushpin pin = new Pushpin();
pin.Location = pinLocation;
pin.Content = counter += 1;
pin.MouseDown += new MouseButtonEventHandler(pin_MouseDown);
myMap.Children.Add(pin);
Pushpins.Add(pin);
}
private void pin_MouseDown(object sender, MouseButtonEventArgs e)
{
e.Handled = true;
var pushPinContent = 0;
var pushPin = sender as Pushpin;
if (pushPin != null & pushPin.GetType() == typeof(Pushpin))
pushPinContent = Convert.ToInt32(pushPin.Content);
myMap.Heading = (double)pushPinContent;
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
5 people are following this question.