mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-04 22:18:56 +00:00
Avalonia MapGraticule
This commit is contained in:
parent
9980733c37
commit
8bb7dc3eb3
13 changed files with 247 additions and 495 deletions
|
|
@ -24,7 +24,7 @@ namespace MapControl
|
|||
if (coerce != null)
|
||||
{
|
||||
// do not coerce default value
|
||||
coerceFunc = (obj, value) => value.Equals(defaultValue) ? value : coerce((TOwner)obj, value);
|
||||
coerceFunc = (obj, value) => Equals(value, defaultValue) ? value : coerce((TOwner)obj, value);
|
||||
}
|
||||
|
||||
var bindingMode = bindTwoWayByDefault ? Avalonia.Data.BindingMode.TwoWay : Avalonia.Data.BindingMode.OneWay;
|
||||
|
|
@ -57,11 +57,17 @@ namespace MapControl
|
|||
|
||||
public static StyledProperty<TValue> AddOwner<TOwner, TValue>(
|
||||
StyledProperty<TValue> property,
|
||||
TValue defaultValue = default,
|
||||
Action<TOwner, TValue, TValue> changed = null)
|
||||
where TOwner : AvaloniaObject
|
||||
{
|
||||
var newProperty = property.AddOwner<TOwner>();
|
||||
|
||||
if (!Equals(defaultValue, newProperty.GetMetadata(typeof(TOwner)).DefaultValue))
|
||||
{
|
||||
newProperty.OverrideMetadata<TOwner>(new StyledPropertyMetadata<TValue>(defaultValue));
|
||||
}
|
||||
|
||||
if (changed != null)
|
||||
{
|
||||
newProperty.Changed.AddClassHandler<TOwner, TValue>((o, e) => changed(o, e.OldValue.Value, e.NewValue.Value));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue