mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Added Avalonia MapContentControl
This commit is contained in:
parent
1e7dd235ef
commit
33cb30c570
|
|
@ -61,5 +61,12 @@ namespace MapControl
|
|||
{
|
||||
return property.AddOwner<TOwner>();
|
||||
}
|
||||
|
||||
public static StyledProperty<TValue> AddOwner<TOwner, TValue>(
|
||||
AvaloniaProperty property)
|
||||
where TOwner : AvaloniaObject
|
||||
{
|
||||
return AddOwner<TOwner, TValue>((StyledProperty<TValue>)property);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
49
MapControl/Avalonia/MapContentControl.Avalonia.cs
Normal file
49
MapControl/Avalonia/MapContentControl.Avalonia.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
||||
// Copyright © 2024 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using Avalonia.Controls;
|
||||
using System;
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
/// <summary>
|
||||
/// ContentControl placed on a MapPanel at a geographic location specified by the Location property.
|
||||
/// </summary>
|
||||
public class MapContentControl : ContentControl
|
||||
{
|
||||
public static readonly StyledProperty<bool> AutoCollapseProperty =
|
||||
DependencyPropertyHelper.AddOwner<MapContentControl, bool>(MapPanel.AutoCollapseProperty);
|
||||
|
||||
public static readonly StyledProperty<Location> LocationProperty =
|
||||
DependencyPropertyHelper.AddOwner<MapContentControl, Location>(MapPanel.LocationProperty);
|
||||
|
||||
protected override Type StyleKeyOverride => typeof(MapContentControl);
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets MapPanel.AutoCollapse.
|
||||
/// </summary>
|
||||
public bool AutoCollapse
|
||||
{
|
||||
get => GetValue(AutoCollapseProperty);
|
||||
set => SetValue(AutoCollapseProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets MapPanel.Location.
|
||||
/// </summary>
|
||||
public Location Location
|
||||
{
|
||||
get => GetValue(LocationProperty);
|
||||
set => SetValue(LocationProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MapContentControl with a Pushpin Style.
|
||||
/// </summary>
|
||||
public class Pushpin : MapContentControl
|
||||
{
|
||||
protected override Type StyleKeyOverride => typeof(Pushpin);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue