Get parent (RadStatusStrip) of RadLabelElement

3 posts, 1 answers
  1. Dominik
    Dominik avatar
    59 posts
    Member since:
    Dec 2012

    Posted 19 Nov 2015 Link to this post

    Hi,

    Code below add StatusStrip with one LabelElement to form. 

    How to get the parent control of LabelElement by code?

    Later on in my code, i must call Invoke method on StatusStrip, but i have only access to LabelElement 

     

    // Add statusbar
    RadStatusStrip status = new RadStatusStrip();
    Controls.Add(status);
     
    // Add label to statusbar
    RadLabelElement label = new RadLabelElement();
    label.Text = "test";
    status.Items.Add(label);
     
    // This is only radelement
    RadStatusBarElement RadStatusBarElement = (RadStatusBarElement)label.Parent.Parent;
     
    // Can't convert like that
    RadStatusStrip RadStatusStrip = (RadStatusStrip)RadStatusBarElement;

  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 20 Nov 2015 Link to this post

    Hi Dominik,

    Thank you for writing.

    The following snippet shows how you can get the control:
    RadStatusStrip RadStatusStrip = label.ElementTree.Control as RadStatusStrip;

    Please let me know if there is something else I can help you with. 

    Regards,
    Dimitar
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dominik
    Dominik avatar
    59 posts
    Member since:
    Dec 2012

    Posted 26 Nov 2015 Link to this post

    Thanks! 
Back to Top