mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-05-07 13:37:47 +00:00
File scoped namespaces
This commit is contained in:
parent
c14377f976
commit
65aba44af6
152 changed files with 11962 additions and 12115 deletions
|
|
@ -6,52 +6,51 @@ using Microsoft.UI.Xaml;
|
|||
using Microsoft.UI.Xaml.Media;
|
||||
#endif
|
||||
|
||||
namespace MapControl
|
||||
namespace MapControl;
|
||||
|
||||
public partial class MapPanel
|
||||
{
|
||||
public partial class MapPanel
|
||||
public static readonly DependencyProperty AutoCollapseProperty =
|
||||
DependencyPropertyHelper.RegisterAttached<bool>("AutoCollapse", typeof(MapPanel));
|
||||
|
||||
public static readonly DependencyProperty LocationProperty =
|
||||
DependencyPropertyHelper.RegisterAttached<Location>("Location", typeof(MapPanel), null,
|
||||
(element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
|
||||
|
||||
public static readonly DependencyProperty BoundingBoxProperty =
|
||||
DependencyPropertyHelper.RegisterAttached<BoundingBox>("BoundingBox", typeof(MapPanel), null,
|
||||
(element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
|
||||
|
||||
public static readonly DependencyProperty MapRectProperty =
|
||||
DependencyPropertyHelper.RegisterAttached<Rect?>("MapRect", typeof(MapPanel), null,
|
||||
(element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
|
||||
|
||||
public static void InitMapElement(FrameworkElement element)
|
||||
{
|
||||
public static readonly DependencyProperty AutoCollapseProperty =
|
||||
DependencyPropertyHelper.RegisterAttached<bool>("AutoCollapse", typeof(MapPanel));
|
||||
// Workaround for missing property value inheritance.
|
||||
// Loaded and Unloaded handlers set and clear the ParentMap property value.
|
||||
//
|
||||
element.Loaded += (_, _) => GetParentMap(element);
|
||||
element.Unloaded += (_, _) => element.ClearValue(ParentMapProperty);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LocationProperty =
|
||||
DependencyPropertyHelper.RegisterAttached<Location>("Location", typeof(MapPanel), null,
|
||||
(element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
|
||||
public static MapBase GetParentMap(FrameworkElement element)
|
||||
{
|
||||
var parentMap = (MapBase)element.GetValue(ParentMapProperty);
|
||||
|
||||
public static readonly DependencyProperty BoundingBoxProperty =
|
||||
DependencyPropertyHelper.RegisterAttached<BoundingBox>("BoundingBox", typeof(MapPanel), null,
|
||||
(element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
|
||||
|
||||
public static readonly DependencyProperty MapRectProperty =
|
||||
DependencyPropertyHelper.RegisterAttached<Rect?>("MapRect", typeof(MapPanel), null,
|
||||
(element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
|
||||
|
||||
public static void InitMapElement(FrameworkElement element)
|
||||
// Traverse visual tree because of missing property value inheritance.
|
||||
//
|
||||
if (parentMap == null &&
|
||||
VisualTreeHelper.GetParent(element) is FrameworkElement parentElement)
|
||||
{
|
||||
// Workaround for missing property value inheritance.
|
||||
// Loaded and Unloaded handlers set and clear the ParentMap property value.
|
||||
//
|
||||
element.Loaded += (_, _) => GetParentMap(element);
|
||||
element.Unloaded += (_, _) => element.ClearValue(ParentMapProperty);
|
||||
}
|
||||
parentMap = (parentElement as MapBase) ?? GetParentMap(parentElement);
|
||||
|
||||
public static MapBase GetParentMap(FrameworkElement element)
|
||||
{
|
||||
var parentMap = (MapBase)element.GetValue(ParentMapProperty);
|
||||
|
||||
// Traverse visual tree because of missing property value inheritance.
|
||||
//
|
||||
if (parentMap == null &&
|
||||
VisualTreeHelper.GetParent(element) is FrameworkElement parentElement)
|
||||
if (parentMap != null)
|
||||
{
|
||||
parentMap = (parentElement as MapBase) ?? GetParentMap(parentElement);
|
||||
|
||||
if (parentMap != null)
|
||||
{
|
||||
element.SetValue(ParentMapProperty, parentMap);
|
||||
}
|
||||
element.SetValue(ParentMapProperty, parentMap);
|
||||
}
|
||||
|
||||
return parentMap;
|
||||
}
|
||||
|
||||
return parentMap;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue