I have a Grid
whose Visibility
property is bound to a boolean property of a certain model using a Converter
:
<Grid Visibility="{Binding ElementName=MyTreeView, Path=SelectedItem.MyBoolProperty, Converter={StaticResource boolToVisConverter}}">
<!-- child elements -->
</Grid>
It works great when an element in my TreeView
is selected, but if nothing is selected or the TreeView
is empty it defaults to being visible. I need it to be hidden by default. I've tried using TargetNullValue=Hidden
but it isn't working. I guess I just don't understand how the TargetNullValue
property is supposed to work in this situation.
Does anybody have any ideas how to get the functionality I am looking for?
I spent hours trying to figure this out. Then, of course, right after I post the question I get it working using FallbackValue=Hidden
on the Binding
property of the Grid
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With