我正在从标签属性中检索工具提示,如下所示,并且标签属性已刷新/正确的工具提示,但是在创建新的工具提示时我没有得到刷新。在鼠标悬停时,我称之为创建工具提示方法。有人可以解释为什么我没有在我的控件中获得刷新的工具提示吗?
private void CreateToolTip(Border border, RealisticControlBase control)
{
border.SetValue(ToolTipService.IsEnabledProperty, false);
if (control != null)
{
FrameworkElement tooltip = ToolTipService.GetToolTip(border) as FrameworkElement;
control.InvalidateArrange();
tooltip.InvalidateArrange();
if ((control.Tag as string) != null)
{
string templatename = control.Tag.ToString();
object abc=Application.Current.FindResource(templatename);
if ((Application.Current.FindResource(templatename) as DataTemplate) != null)
{
(tooltip as ToolTip).ContentTemplate = Application.Current.FindResource(templatename) as DataTemplate;
tooltip.DataContext = control.DataContext;
border.SetValue(ToolTipService.IsEnabledProperty, true);
(tooltip as ToolTip).Content = control.DataContext;
}
}
}