private static void OnAttachPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if ((bool)e.NewValue) { d.SetValue(TextBlockToolTipPropertyKey, TextBlockTooltipAttachment.Attach((TextBlock)d, null)); } else { var attached = d.GetValue(TextBlockToolTipPropertyKey.DependencyProperty) as TextBlockTooltipAttachment; if (attached != null) { attached.Dispose(); } } }
public static void Attach(TextBlock tb, FrameworkElement parent) { TextBlockTooltipAttachment.Attach(tb, parent); }