2013-04-12 19:59:16 +02:00
|
|
|
|
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
2015-01-20 17:52:02 +01:00
|
|
|
|
// © 2015 Clemens Fischer
|
2013-04-12 19:59:16 +02:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
2014-07-01 18:57:44 +02:00
|
|
|
|
#if WINDOWS_RUNTIME
|
2015-02-10 21:59:39 +01:00
|
|
|
|
using Windows.Foundation;
|
|
|
|
|
|
using Windows.UI.Xaml.Media;
|
2013-04-12 19:59:16 +02:00
|
|
|
|
using Windows.UI.Xaml.Shapes;
|
|
|
|
|
|
#else
|
2015-02-10 21:59:39 +01:00
|
|
|
|
using System.Windows;
|
|
|
|
|
|
using System.Windows.Media;
|
2013-04-12 19:59:16 +02:00
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
2013-05-25 08:53:50 +02:00
|
|
|
|
public partial class MapPath : Path
|
2013-04-12 19:59:16 +02:00
|
|
|
|
{
|
2015-02-18 19:20:59 +01:00
|
|
|
|
private Geometry data;
|
|
|
|
|
|
|
2013-05-25 08:53:50 +02:00
|
|
|
|
public MapPath()
|
2013-04-12 19:59:16 +02:00
|
|
|
|
{
|
|
|
|
|
|
MapPanel.AddParentMapHandlers(this);
|
|
|
|
|
|
}
|
2015-02-10 21:59:39 +01:00
|
|
|
|
|
|
|
|
|
|
protected override Size MeasureOverride(Size constraint)
|
|
|
|
|
|
{
|
2015-02-18 19:20:59 +01:00
|
|
|
|
if (Stretch != Stretch.None)
|
|
|
|
|
|
{
|
|
|
|
|
|
Stretch = Stretch.None;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-02-10 21:59:39 +01:00
|
|
|
|
// Work-around for missing PropertyChangedCallback for the Data property.
|
|
|
|
|
|
if (data != Data)
|
|
|
|
|
|
{
|
|
|
|
|
|
data = Data;
|
|
|
|
|
|
UpdateData();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Path.MeasureOverride in Windows Runtime sometimes returns an empty Size,
|
|
|
|
|
|
// whereas in Silverlight it occasionally throws an ArgumentException,
|
|
|
|
|
|
// apparently because it tries to create a Size from negative width or height,
|
|
|
|
|
|
// which result from a transformed Geometry.
|
|
|
|
|
|
// In either case it seems to be sufficient to simply return a non-zero size.
|
|
|
|
|
|
return new Size(1, 1);
|
|
|
|
|
|
}
|
2013-04-12 19:59:16 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|