ParentMap property initialization

This commit is contained in:
ClemensF 2021-01-17 00:31:30 +01:00
parent 6a9b622793
commit 207565feba
12 changed files with 86 additions and 47 deletions

View file

@ -26,19 +26,19 @@ namespace MapControl
public static readonly DependencyProperty ParentMapProperty = ParentMapPropertyKey.DependencyProperty;
public static readonly DependencyProperty ViewPositionProperty = ViewPositionPropertyKey.DependencyProperty;
public MapPanel()
{
if (this is MapBase)
{
SetValue(ParentMapPropertyKey, this);
}
}
public static MapBase GetParentMap(FrameworkElement element)
{
return (MapBase)element.GetValue(ParentMapProperty);
}
public static void InitMapElement(FrameworkElement element)
{
if (element is MapBase)
{
element.SetValue(ParentMapPropertyKey, element);
}
}
private static void SetViewPosition(FrameworkElement element, Point? viewPosition)
{
element.SetValue(ViewPositionPropertyKey, viewPosition);