mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
72 lines
1.7 KiB
C#
72 lines
1.7 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.ObjectModel;
|
|||
|
|
using System.Windows;
|
|||
|
|
using System.Windows.Controls;
|
|||
|
|
using MapControl;
|
|||
|
|
|
|||
|
|
namespace MapControlTestApp
|
|||
|
|
{
|
|||
|
|
class SampleItem
|
|||
|
|
{
|
|||
|
|
public string Name { get; set; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
class SamplePoint : SampleItem
|
|||
|
|
{
|
|||
|
|
public Location Location { get; set; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
class SamplePushpin : SamplePoint
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
class SampleShape : SamplePoint
|
|||
|
|
{
|
|||
|
|
public double RadiusX { get; set; }
|
|||
|
|
public double RadiusY { get; set; }
|
|||
|
|
public double Rotation { get; set; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
class SamplePolyline : SampleItem
|
|||
|
|
{
|
|||
|
|
public LocationCollection Locations { get; set; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
class SamplePolygon : SampleItem
|
|||
|
|
{
|
|||
|
|
public LocationCollection Locations { get; set; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
class SampleItemCollection : ObservableCollection<SampleItem>
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
class SampleItemStyleSelector : StyleSelector
|
|||
|
|
{
|
|||
|
|
public override Style SelectStyle(object item, DependencyObject container)
|
|||
|
|
{
|
|||
|
|
if (item is SamplePolyline)
|
|||
|
|
{
|
|||
|
|
return Application.Current.Windows[0].Resources["SamplePolylineItemStyle"] as Style;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (item is SamplePolygon)
|
|||
|
|
{
|
|||
|
|
return Application.Current.Windows[0].Resources["SamplePolygonItemStyle"] as Style;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (item is SampleShape)
|
|||
|
|
{
|
|||
|
|
return Application.Current.Windows[0].Resources["SampleShapeItemStyle"] as Style;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (item is SamplePushpin)
|
|||
|
|
{
|
|||
|
|
return Application.Current.Windows[0].Resources["SamplePushpinItemStyle"] as Style;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Application.Current.Windows[0].Resources["SamplePointItemStyle"] as Style;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|