Tuesday, February 21, 2012

Add a ToolTip in Code

Today I had to create many controls in code (not XAML).  I wanted to add tooltips as I created them:
void AddManyControls()
{
    var control = new Control();
    ToolTip toolTip = new ToolTip 
    { 
        Content = "ToolTip Content"
    }

    ToolTipService.SetToolTip(control, toolTip); 
}

No comments:

Post a Comment