How to convert this code-based WPF tooltip to Silverlight?

Posted by Edward Tanguay on Stack Overflow See other posts from Stack Overflow or by Edward Tanguay
Published on 2010-03-18T11:19:51Z Indexed on 2010/03/18 11:21 UTC
Read the original article Hit count: 526

Filed under:
|
|

The following ToolTip code works in WPF.

I'm trying to get it to work in Silverlight.

But it gives me these errors:

TextBlock does not contain a definition for ToolTip.
Cursors does not contain a definition for Help.
ToolTipService does not contain a definition for SetInitialShowDelay.

How can I get this to work in 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);
        }
    }
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about Silverlight