我需要为 DataGrid
(Silverlight 4) 的列标题添加工具提示。我将动态生成列数和列标题文本。
GridColumnCreation(....)
{
IEnumerable allHeaderText = /* Linq query */;
}
如何使用这个集合来设置tooltip?
最佳答案
这可以比@Farukh 的回答更简单:
<data:DataGridTextColumn.HeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="ToolTipService.ToolTipProperty"
Value="Your tool tip here" />
</Style>
</data:DataGridTextColumn.HeaderStyle>
或者,如果您需要在代码中执行此操作:
var style = new Style(typeof(DataGridColumnHeader));
style.Setters.Add(new Setter(ToolTipService.ToolTipProperty,
"Your tool tip here"));
column.HeaderStyle = style;
关于c# - 如何为动态生成标题文本的数据网格标题添加工具提示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4615081/