Added DependencyPropertyHelper.AddOwner

This commit is contained in:
ClemensFischer 2026-02-02 14:52:58 +01:00
parent f78bcb33fa
commit a3d25b5084
12 changed files with 119 additions and 133 deletions

View file

@ -74,11 +74,27 @@ namespace MapControl
Action<TOwner, TValue, TValue> changed) where TOwner : AvaloniaObject
{
var property = source.AddOwner<TOwner>();
property.Changed.AddClassHandler<TOwner, TValue>((o, e) => changed(o, e.OldValue.Value, e.NewValue.Value));
return property;
}
public static StyledProperty<TValue> AddOwner<TOwner, TValue>(
string _, // for compatibility with WinUI/UWP DependencyPropertyHelper
StyledProperty<TValue> source) where TOwner : AvaloniaObject
{
return AddOwner<TOwner, TValue>(source);
}
public static StyledProperty<TValue> AddOwner<TOwner, TValue>(
string _, // for compatibility with WinUI/UWP DependencyPropertyHelper
StyledProperty<TValue> source,
Action<TOwner, TValue, TValue> changed) where TOwner : AvaloniaObject
{
return AddOwner(source, changed);
}
public static void SetBinding(this AvaloniaObject target, AvaloniaProperty property, Binding binding)
{
target.Bind(property, binding);