DataTemplate bind to the whole item
xmedeko opened this issue · comments
I have a <ListBox>
with <DataTemplate>
and I need to bind Visibility
to the condition, if the item is null or not. In a bare WPF I use
<TextBlock Text="Item is null" Visibility="{Binding Converter={StaticResource IsNullConverter}}" />
However, I would like to use a fancy CalcBinding, something like
<TextBlock Text="Item is null" Visibility="{cb:Binding '. == null'" />
How to denote the whole item in the expression (.
is not working).
As workaround I can offer this:
<TextBlock Text="Item is null" Visibility="{cb:Binding Path='DataContext == null', RelativeSource={RelativeSource Self}}" />