I'm new to wpf and im having trouble adding tooltips to my datagrid header from code-behind.
I need to use autogeneratecolumns on the datagrid which rules out xaml editing. All examples i could find involved som xaml editing.
I've tried to add it the DataGridTextColumn without succeding
private void dataGrid1_AutoGeneratedColumns(object sender, EventArgs e)
{
foreach (DataGridTextColumn item in dataGrid1.Columns)
{
ToolTip tooltip = new ToolTip();
tooltip.Content = "Test";
ToolTipService.SetToolTip(item, tooltip);
}
}
I can see that the ToolTip variable is set in the WPF visualizer but nothing shows in the datagrid.
Help!