如何数据网格单元格工具提示大小(Height/width)?

How to datagrid cell tooltip size(Height/width)?

我创建了一个 WPF 应用程序,其中包含一个 DataGrid。我可以轻松地为单元格设置工具提示。我想做的是能够手动设置此工具提示的宽度和高度。我有以下 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>

但是设置为 Tooltip.WidthTooltip.Height 的值将应用于单元格大小,即使我也设置了单元格的高度和宽度。我试过设置Tooltip.WidthTooltip.Height,但没有用。有人可以帮忙吗?

试试这个

<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>