Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Set TargetNullValue to Visibility.Collapsed in Binding

I'm binding TextBlock.Visiblitiy to something, and I want to set the Binding.TargetNullValue to Collapsed, how can I do it in XAML?

This one How do I set TargetNullValue to a date? does not work in Silverlight. (No x:Static).

like image 415
Peter Lee Avatar asked Jan 01 '12 11:01

Peter Lee


1 Answers

This is working for me in SL4:

<TextBlock Text="Text" Visibility="{Binding Foo, TargetNullValue=Collapsed}"/>

Where Foo:

public Visibility? Foo { get; set; }
like image 123
nemesv Avatar answered Nov 18 '22 15:11

nemesv