Getting to tooltips from radcontrol

3 posts, 1 answers
  1. Ruth Goldberg
    Ruth Goldberg avatar
    54 posts
    Member since:
    Dec 2009

    Posted 14 Jan 2010 Link to this post

    I'm trying to loop through all controls and translate text and tooltips. The text is under the control and the tag (which I'm using) can be found under the ElementTree.RootElement. I see that the toottip is under RadItem. How do I get to the RadItem from a RadControl or RadElement?
  2. Answer
    Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 20 Jan 2010 Link to this post

    Hi Ruth Goldberg,

    Thank you for writing. Actually, there is no way to change the ToolTip for every control without taking into account the RadControl type. You can iterate over all controls and set the ToolTipText, but you will notice that this will not work for every RadControl:

    foreach (Control control in this.Controls)
    {
        if (control is RadControl)
        {
            RadItem item = ((RadControl)control).RootElement.Children[0] as RadItem;
            item.ToolTipText = "myText";                  
        }
    }

    You have to do this considering the specific controls that you have used in your form. Write me back if you have any additional questions.

    Best wishes,
    Martin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ruth Goldberg
    Ruth Goldberg avatar
    54 posts
    Member since:
    Dec 2009

    Posted 21 Jan 2010 Link to this post

    Thank you for your reply. I had actually figured out by the time I got your reply that the controls with tooltips were items under their parent control. However, I was testing each type of control separately and casting to the appropriate control type. With your method, I can trap other types that I might have missed by just checking if the child is a RadItem type.
Back to Top