Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4380690
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:33:47+00:00 2026-05-21T12:33:47+00:00

hopefully some WPF ninja can explain to me why if I have a tab

  • 0

hopefully some WPF ninja can explain to me why if I have a tab control and in my tab I put content (in this case a user control) into a ItemsControl or ContentControl the content in the contentControl will expand and fill up the whole screen but if it is in an items control it will not… I think the example will make this more clear.

 public MainWindow()
{
  InitializeComponent();

  //This content won't expand to fill the available space
  var t1 = new TabItem();
  t1.Header = "Tab One";
  var ic = new ItemsControl();
  ic.Items.Add(new UserControl1());
  t1.Content = ic;

  //in this case the label will fill up the whole window...
  var t2 = new TabItem();
  t2.Header = "Tab Two";
  var c = new ContentControl();
  c.Content = new UserControl1();
  t2.Content = c;

  MyTab.Items.Add(t1);
  MyTab.Items.Add(t2);
}

here is the XAML for the window.

 <Grid>
    <TabControl Name="MyTab">

    </TabControl>
</Grid>

Here is the user control – nothing but a label…

<UserControl x:Class="TabControlTest.UserControl1"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         mc:Ignorable="d" 
         d:DesignHeight="300" d:DesignWidth="300" Background="Red">
<Label Content="User control one"/>

Thanks!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T12:33:47+00:00Added an answer on May 21, 2026 at 12:33 pm

    ContentControl is intended to display a single piece of content. By default, it will stretch to fill its entire containing region, and the content within the ContentControl will stretch to fill it.

    ItemsControl, as suggested by the name, is meant to display multiple items within it. It will fill its containing region, but the content items added will only take up the space they require. This is because it is intended to allow more than a single item to be added – if the first item stretched to fill up the space, there would be no “room” for the other items added later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hopefully some Custom Control Designers/Builders can help I'm attempting to build my first custom
Hopefully this is a simple one, but can anyone provide some simple c# code
Hopefully some of you .htaccess gurus can help me out with this one. I
I'm new to WPF and data binding so hopefully I can explain the problem
Hopefully I can find some words of advice from somebody. Is it possible to
hopefully this will be an easy answer for some of you CSS veterans out
hopefully this doesn't sound ridiculous, but are some parts of the web.config not required
I'm developing directly on the mobile device, and I have some questions you hopefully
Hopefully, this won't be a silly question. Assume I have the following model: var
Hopefully this will be a straightforward solution but I can't seem to solve it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.