我正在尝试使其在Silverlight中工作.
但这给了我这些错误:
TextBlock does not contain a deFinition for ToolTip.
Cursors does not contain a deFinition for Help.
ToolTipService does not contain a deFinition for SetinitialShowDelay.
我如何才能在Silverlight中使用它?
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace TestHover29282
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
AddCustomer("Jim Smith");
AddCustomer("Joe Jones");
AddCustomer("Angie Jones");
AddCustomer("Josh Smith");
}
void AddCustomer(string name)
{
TextBlock tb = new TextBlock();
tb.Text = name;
ToolTip tt = new ToolTip();
tt.Content = "This is some info on " + name + ".";
tb.ToolTip = tt;
tt.Cursor = Cursors.Help;
ToolTipService.SetinitialShowDelay(tb, 0);
MainStackPanel.Children.Add(tb);
}
}
}
解决方法:
使用ToolTipService提供的附加属性将工具提示添加到Silverlight控件. Silverlight的版本中没有SetinitialShowDelay,在Cursors类型上也没有帮助光标.
void AddCustomer(string name)
{
TextBlock tb = new TextBlock();
tb.Text = name;
ToolTip tt = new ToolTip();
tt.Content = "This is some info on " + name + ".";
ToolTipService.SetToolTip(tb, tt);
MainStackPanel.Children.Add(tb);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。