MapItemsControl SelectedItem

This commit is contained in:
ClemensFischer 2024-05-31 00:08:41 +02:00
parent ec13e13af7
commit 1aa233bc79
4 changed files with 36 additions and 15 deletions

View file

@ -1,12 +1,12 @@
using MapControl;
using System.Collections.Generic;
using System.Diagnostics;
namespace SampleApplication
{
public class PointItem
{
public string Name { get; set; }
public Location Location { get; set; }
}
@ -21,6 +21,18 @@ namespace SampleApplication
public List<PointItem> Pushpins { get; } = new List<PointItem>();
public List<PolylineItem> Polylines { get; } = new List<PolylineItem>();
private PointItem selectedPushpin;
public PointItem SelectedPushpin
{
get => selectedPushpin;
set
{
selectedPushpin = value;
Debug.WriteLine(selectedPushpin?.Name);
}
}
public MapViewModel()
{
Points.Add(new PointItem
@ -62,7 +74,7 @@ namespace SampleApplication
Pushpins.Add(new PointItem
{
Name = "WHV - Eckwarderhörne",
Location = new Location(53.5495, 8.1877)
Location = new Location(53.5495, 8.1877),
});
Pushpins.Add(new PointItem
@ -83,6 +95,8 @@ namespace SampleApplication
Location = new Location(53.5207, 8.2323)
});
SelectedPushpin = Pushpins[0];
Polylines.Add(new PolylineItem
{
Locations = LocationCollection.Parse("53.5140,8.1451 53.5123,8.1506 53.5156,8.1623 53.5276,8.1757 53.5491,8.1852 53.5495,8.1877 53.5426,8.1993 53.5184,8.2219 53.5182,8.2386 53.5195,8.2387")