Guest GraphiteCube Posted October 31, 2009 Share Posted October 31, 2009 Hello. I created an UserControl object, which let me put buttons, labels and other controls in it. Now I want to do 2 things: 1. Put the UserControl object into the content of a TabItem. 2. Set the width and height of UserControl object to fill the content of TabItem. I did the first task, but I can't find a way to do the second task. I tried to set HorizontalAlignment/ VerticalAlignment to Stretch: control.HorizontalAlignment = HorizontalAlignment.Stretch; Where control is an UserControl object, but it didn't work. I also tried to set the margin, it didn't work too (I think the margin isn't related to the size of UserControl, right?). Could someone give me some hints? Thanks a lot! Link to comment Share on other sites More sharing options...
0 ramesees Posted November 3, 2009 Share Posted November 3, 2009 Try setting the Dock property of the Control to DockStyle.Fill That should do what you want Link to comment Share on other sites More sharing options...
Question
Guest GraphiteCube
Hello. I created an UserControl object, which let me put buttons, labels and other controls in it.
Now I want to do 2 things:
1. Put the UserControl object into the content of a TabItem.
2. Set the width and height of UserControl object to fill the content of TabItem.
I did the first task, but I can't find a way to do the second task. I tried to set HorizontalAlignment/ VerticalAlignment to Stretch:
Where control is an UserControl object, but it didn't work. I also tried to set the margin, it didn't work too (I think the margin isn't related to the size of UserControl, right?).
Could someone give me some hints?
Thanks a lot!
Link to comment
Share on other sites
1 answer to this question
Recommended Posts