如何将这个基于代码的WPF工具提示转换为Silverlight?
以下ToolTip代码适用于WPF 。
我试图让它在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
类型上也没有Help
光标。
上述就是C#学习教程:如何将这个基于代码的WPF工具提示转换为Silverlight?分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
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); }
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/cdevelopment/949231.html