I have created a WPF application which includes a DataGrid. I can easily set a tooltip for the cells. What I would like to do is to be able to set the width and height of this tooltip manually. I have the following XAML:
<DataGridTextColumn x:Name="MessageColumnTooltip"
Binding="{Binding Message}" Header="Message" Width="*" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="ToolTip" Value="{Binding Message}" />
<Setter Property="ToolTip.Width" Value="10" />
<Setter Property="ToolTip.Height" Value="10" />
<Setter Property="Width" Value="auto"/>
<Setter Property="Height" Value="auto"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
But the value set to Tooltip.Width and Tooltip.Height is applied to the cell size instead even though I set the Height and Width of of the cell as well. I have tried to only set Tooltip.Width and Tooltip.Height as well, but did not work. Could anyone help please?
Try this
<DataGridTextColumn x:Name="MessageColumnTooltip" Binding="{Binding Message}" Header="Message" Width="*" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="ToolTip">
<Setter.Value>
<ToolTip Width="500" Height="500">
<TextBlock Text="{Binding Message}" />
</ToolTip>
</Setter.Value>
</Setter>
<Setter Property="Width" Value="auto"/>
<Setter Property="Height" Value="auto"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>