/// <summary> /// Adds the specified tooltip to the column header /// </summary> /// <param name="col">The column</param> /// <param name="toolTip">The tool tip</param> /// <returns>The column</returns> /// <remarks> /// <para> /// If <see cref="UseDeferredToolTip"/> is true, this method sets /// the <see cref="ToolTipService.ToolTipProperty"/> attached property /// which is processed after the data grid is loaded in order to establish /// the tool tip on the corresponding <see cref="DataGridColumnHeader"/>. /// You must use the toolkit <see cref="DataGrid"/> for this to work. /// </para> /// <para> /// If <see cref="UseDeferredToolTip"/> is false (the default), this method /// checks to see if the <see cref="DataGridColumn.Header"/> property is /// a FrameworkElement; if so, it sets its ToolTip property. /// </para> /// <para> /// If <see cref="UseDeferredToolTip"/> is false, you can still use the /// <see cref="AddToolTipDeferred(DataGridColumn, object)"/> extension /// method, with the same caveat that the data grid must be the toolkit /// <see cref="DataGrid"/> /// </para> /// <para> /// The advantage of setting the tool tip on <see cref="DataGridColumnHeader"/> /// is that the tool tip appears in any part of the header; otherwise, it /// only appears on the actual content of the header /// </para> /// </remarks> public static DataGridColumn AddToolTip(this DataGridColumn col, object toolTip) { if (UseDeferredToolTip) { return(col.AddToolTipDeferred(toolTip)); } if (col.Header is FrameworkElement element) { element.ToolTip = toolTip; } return(col); }