<DataGrid x:Name="dgRecords1"
CanUserAddRows="False" IsReadOnly="True"
ColumnHeaderStyle="{DynamicResource DataGridColumnHeaderStyle1}"
Style="{DynamicResource StyleDatagrid}"
SelectionChanged="dgRecords1_SelectionChanged"
Height="251" Width="569" Margin="41,173,168,0">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="ToolTip">
<Setter.Value>
<Border Width="200" Height="80"
BorderBrush="Black" BorderThickness="1"
Background="AliceBlue">
<StackPanel Orientation="Vertical">
<StackPanel Height="30" Background="Black">
<TextBlock Text="Email Sent To"
FontSize="14" FontWeight="Bold" Foreground="White"/>
</StackPanel>
<StackPanel>
<TextBlock Text="{Binding SentToList}"
TextWrapping="Wrap" FontWeight="Bold"/>
</StackPanel>
</StackPanel>
</Border>
</Setter.Value>
</Setter>
</Style>
</DataGrid.RowStyle>
In the code above,
<TextBlock TextWrapping="Wrap" FontWeight="Bold" Text="{Binding SentToList}" />
I want to check whether there is something in this textblock, and if there is nothing, I need to make the tooltip invisible. Is there some way of doing it using Triggers?
You could surround your Border by a ToolTip control and bind the Visibility of that control to the same
SentToList
property by using a binding converter that converts from string to Visibility.The converter might look like this: