I have a custom Column:
<DataGridTemplateColumn Width="*" Header="Name">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding DisplayName}" />
<TextBlock Foreground="Gray" Text="{Binding PrivateMessage}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
I would like to have the TextBlock {Binding PrivateMessage} disappear if it is given an empty string “” such that the DisplayName is centered in the middle and not ontop of it.
Is this possible in WPF?
1 Answer