chaffery
chaffery

Reputation: 1

WPF setting parent of label in WPF

I have being using winforms for a long time, my project friends from university decided to change project forms to wpf. I have 3 questions

how do I set a parent of label?

labels[i].Parent = GroupLabelBox; (for my winforms)

Second createcontrol function

labels[i].CreateControl();

third one is bringtofront

labels[i].BringToFront();

Do you have any suggestion how can I determine difference on msdn which methods or parameters use for wpf or forms? (it would be nice for future cases )

Upvotes: 0

Views: 383

Answers (1)

Chronophylos
Chronophylos

Reputation: 21

yourParent.Children.Add(yourlabel);

as far as i know you cant set a parent but a children
msdn: https://msdn.microsoft.com/en-us/library/system.windows.controls.panel.children%28v=vs.110%29.aspx

for the secont part you can cange the ZIndex of your label: How do I bring an item to the front in wpf?

Canvas.SetZIndex(yourlabel, 1);

msdn: https://msdn.microsoft.com/en-us/library/system.windows.controls.panel.setzindex%28v=vs.110%29.aspx

to bring an label to the front i would just set the ZIndex to something low (i think lower means front, i may be wrong)

Upvotes: 1

Related Questions