mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-04 22:18:56 +00:00
Default Styles/ControlThemes
This commit is contained in:
parent
4608f9a511
commit
dd7a4814af
8 changed files with 34 additions and 67 deletions
|
|
@ -93,14 +93,20 @@ namespace MapControl
|
|||
|
||||
public static DependencyProperty AddOwner<TOwner, TValue>(
|
||||
DependencyProperty property,
|
||||
TValue defaultValue = default,
|
||||
Action<TOwner, TValue, TValue> changed = null)
|
||||
where TOwner : DependencyObject
|
||||
{
|
||||
FrameworkPropertyMetadata metadata = null;
|
||||
var metadata = new FrameworkPropertyMetadata();
|
||||
|
||||
if (!Equals(defaultValue, property.GetMetadata(typeof(TOwner)).DefaultValue))
|
||||
{
|
||||
metadata.DefaultValue = defaultValue;
|
||||
}
|
||||
|
||||
if (changed != null)
|
||||
{
|
||||
metadata = new FrameworkPropertyMetadata((o, e) => changed((TOwner)o, (TValue)e.OldValue, (TValue)e.NewValue));
|
||||
metadata.PropertyChangedCallback = (o, e) => changed((TOwner)o, (TValue)e.OldValue, (TValue)e.NewValue);
|
||||
}
|
||||
|
||||
return property.AddOwner(typeof(TOwner), metadata);
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ namespace MapControl
|
|||
|
||||
static MapBase()
|
||||
{
|
||||
BackgroundProperty.OverrideMetadata(typeof(MapBase), new FrameworkPropertyMetadata(Brushes.White));
|
||||
ClipToBoundsProperty.OverrideMetadata(typeof(MapBase), new FrameworkPropertyMetadata(true));
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(MapBase), new FrameworkPropertyMetadata(typeof(MapBase)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace MapControl
|
|||
DependencyPropertyHelper.AddOwner<MapItem, bool>(MapPanel.AutoCollapseProperty);
|
||||
|
||||
public static readonly DependencyProperty LocationProperty =
|
||||
DependencyPropertyHelper.AddOwner<MapItem, Location>(MapPanel.LocationProperty,
|
||||
DependencyPropertyHelper.AddOwner<MapItem, Location>(MapPanel.LocationProperty, null,
|
||||
(item, oldValue, newValue) => item.UpdateMapTransform(newValue));
|
||||
|
||||
static MapItem()
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace MapControl
|
|||
}
|
||||
|
||||
public static readonly DependencyProperty DataProperty =
|
||||
DependencyPropertyHelper.AddOwner<MapPath, Geometry>(Path.DataProperty,
|
||||
DependencyPropertyHelper.AddOwner<MapPath, Geometry>(Path.DataProperty, null,
|
||||
(path, oldValue, newValue) => path.DataPropertyChanged(oldValue, newValue));
|
||||
|
||||
public Geometry Data
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
xmlns:map="clr-namespace:MapControl">
|
||||
|
||||
<Style TargetType="map:MapBase">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
</Style>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue