|
|
@@ -38,7 +38,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions
|
|
|
Assert.Equal("foobar", textBlock.Text);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
[Fact]
|
|
|
public void BindingExtension_Binds_To_TargetNullValue()
|
|
|
{
|
|
|
@@ -65,6 +65,28 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ [Fact]
|
|
|
+ public void BindingExtension_TargetNullValue_UnsetByDefault()
|
|
|
+ {
|
|
|
+ using (StyledWindow())
|
|
|
+ {
|
|
|
+ var xaml = @"
|
|
|
+<Window xmlns='https://github.com/avaloniaui'
|
|
|
+ xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
|
|
|
+ <TextBlock Name='textBlock' IsVisible='{Binding Foo, Converter={x:Static ObjectConverters.IsNotNull}}'/>
|
|
|
+</Window>";
|
|
|
+
|
|
|
+ var loader = new AvaloniaXamlLoader();
|
|
|
+ var window = (Window)loader.Load(xaml);
|
|
|
+ var textBlock = window.FindControl<TextBlock>("textBlock");
|
|
|
+
|
|
|
+ window.DataContext = new FooBar();
|
|
|
+ window.Show();
|
|
|
+
|
|
|
+ Assert.Equal(false, textBlock.IsVisible);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private class FooBar
|
|
|
{
|
|
|
public object Foo { get; } = null;
|