using Infragistics.Win.UltraWinGrid; /// /// Uses IUIElementCreationFilter to intercept HeaderUIElements and /// reassigns their ToolTipItem property for the purpose of constraining /// the tooltip's width. /// public class HeaderToolTipWidthConstraint : IUIElementCreationFilter { public HeaderToolTipWidthConstraint(int maxWidth) { this.MaxWidth = maxWidth; } public int MaxWidth { get; private set; } void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent) { HeaderUIElement headerElement = parent as HeaderUIElement; GroupHeader header = headerElement != null ? headerElement.Header as GroupHeader : null; if ( header != null ) headerElement.ToolTipItem = new ToolTipItem(header.ToolTipText, this.MaxWidth); } bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent) { return false; } private class ToolTipItem : IToolTipItem { public ToolTipItem(string text, int maxWidth) { this.Text = text; this.MaxWidth = maxWidth; } private string Text { get; set; } private int MaxWidth { get; set; } ToolTipInfo IToolTipItem.GetToolTipInfo( Point mousePosition, UIElement element, UIElement previousToolTipElement, ToolTipInfo tti) { tti.ToolTipText = this.Text; tti.MaxWidth = this.MaxWidth; return tti; } } }