mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
MapPanel constructor
This commit is contained in:
parent
fde4eccf12
commit
71e7e29200
4 changed files with 22 additions and 30 deletions
|
|
@ -25,26 +25,18 @@ namespace MapControl
|
|||
|
||||
protected IEnumerable<FrameworkElement> ChildElements => Children.OfType<FrameworkElement>();
|
||||
|
||||
public MapPanel()
|
||||
partial void InitMapPanel()
|
||||
{
|
||||
UseLayoutRounding = false;
|
||||
InitMapElement(this);
|
||||
}
|
||||
|
||||
public static void InitMapElement(FrameworkElement element)
|
||||
{
|
||||
if (element is MapBase)
|
||||
{
|
||||
element.SetValue(ParentMapProperty, element);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Workaround for missing property value inheritance.
|
||||
// Loaded and Unloaded handlers set and clear the ParentMap property value.
|
||||
//
|
||||
element.Loaded += (s, e) => GetParentMap((FrameworkElement)s);
|
||||
element.Unloaded += (s, e) => ((FrameworkElement)s).ClearValue(ParentMapProperty);
|
||||
}
|
||||
// Workaround for missing property value inheritance.
|
||||
// Loaded and Unloaded handlers set and clear the ParentMap property value.
|
||||
//
|
||||
element.Loaded += (s, e) => GetParentMap((FrameworkElement)s);
|
||||
element.Unloaded += (s, e) => ((FrameworkElement)s).ClearValue(ParentMapProperty);
|
||||
}
|
||||
|
||||
public static MapBase GetParentMap(FrameworkElement element)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue