|
|
@@ -79,6 +79,20 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
|
|
|
Assert.Equal(21.0, TextBlock.GetFontSize(target));
|
|
|
}
|
|
|
|
|
|
+ [Fact]
|
|
|
+ public void Attached_Property_With_Namespace_Is_Set()
|
|
|
+ {
|
|
|
+ var xaml =
|
|
|
+ @"<ContentControl xmlns='https://github.com/avaloniaui'
|
|
|
+ xmlns:test='clr-namespace:Avalonia.Markup.Xaml.UnitTests.Xaml;assembly=Avalonia.Markup.Xaml.UnitTests'
|
|
|
+ test:BasicTestsAttachedPropertyHolder.Foo='Bar'/>";
|
|
|
+
|
|
|
+ var target = AvaloniaXamlLoader.Parse<ContentControl>(xaml);
|
|
|
+
|
|
|
+ Assert.NotNull(target);
|
|
|
+ Assert.Equal("Bar", BasicTestsAttachedPropertyHolder.GetFoo(target));
|
|
|
+ }
|
|
|
+
|
|
|
[Fact]
|
|
|
public void Attached_Property_Supports_Binding()
|
|
|
{
|
|
|
@@ -873,4 +887,13 @@ do we need it?")]
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ public class BasicTestsAttachedPropertyHolder
|
|
|
+ {
|
|
|
+ public static AvaloniaProperty<string> FooProperty =
|
|
|
+ AvaloniaProperty.RegisterAttached<BasicTestsAttachedPropertyHolder, AvaloniaObject, string>("Foo");
|
|
|
+
|
|
|
+ public static void SetFoo(AvaloniaObject target, string value) => target.SetValue(FooProperty, value);
|
|
|
+ public static string GetFoo(AvaloniaObject target) => (string)target.GetValue(FooProperty);
|
|
|
+
|
|
|
+ }
|
|
|
}
|