mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-07 15:36:20 +00:00
Added DependencyPropertyHelper.AddOwner
This commit is contained in:
parent
f78bcb33fa
commit
a3d25b5084
12 changed files with 119 additions and 133 deletions
|
|
@ -40,5 +40,20 @@ namespace MapControl
|
|||
|
||||
return DependencyProperty.Register(name, typeof(TValue), typeof(TOwner), metadata);
|
||||
}
|
||||
|
||||
public static DependencyProperty AddOwner<TOwner, TValue>(
|
||||
string name,
|
||||
DependencyProperty source,
|
||||
Action<TOwner, TValue, TValue> changed = null)
|
||||
where TOwner : DependencyObject
|
||||
{
|
||||
var metadata = new PropertyMetadata(default, (o, e) =>
|
||||
{
|
||||
o.SetValue(source, e.NewValue);
|
||||
changed?.Invoke((TOwner)o, (TValue)e.OldValue, (TValue)e.NewValue);
|
||||
});
|
||||
|
||||
return DependencyProperty.Register(name, typeof(TValue), typeof(TOwner), metadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue