This is a migrated thread and some comments may be shown as answers.

Get parent (RadStatusStrip) of RadLabelElement

2 Answers 124 Views
StatusStrip
This is a migrated thread and some comments may be shown as answers.
konrad
Top achievements
Rank 1
konrad asked on 19 Nov 2015, 11:04 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 20 Nov 2015, 12:22 PM
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
0
konrad
Top achievements
Rank 1
answered on 26 Nov 2015, 10:12 AM
Thanks! 
Tags
StatusStrip
Asked by
konrad
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
konrad
Top achievements
Rank 1
Share this question
or