• 0

[C#] How to place user control in content of TabItem?


Question

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

1 answer to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.