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

  • Home
  • SEARCH
  • 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 233349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:05:36+00:00 2026-05-11T20:05:36+00:00

My non-databound TabControl looks fine: alt text http://tanguay.info/web/external/tabControlPlain.png <TabControl Width=225 Height=150> <TabItem Header=One> <TextBlock

  • 0

My non-databound TabControl looks fine:

alt text http://tanguay.info/web/external/tabControlPlain.png

<TabControl Width="225" Height="150">
    <TabItem Header="One">
        <TextBlock Margin="10" Text="This is the text block"/>
    </TabItem>
    <TabItem Header="Two"/>
    <TabItem Header="Three"/>
    <TabItem Header="Four"/>
</TabControl>

But my databound TabControl looks like this:

alt text http://tanguay.info/web/external/tabBound.png

<Window.Resources>
    <DataTemplate x:Key="TheTabControl">
        <TabItem Header="{Binding Title}">
            <TextBlock Text="{Binding Description}" Margin="10"/>
        </TabItem>
    </DataTemplate>
</Window.Resources>

<TabControl Width="225" Height="150" ItemsSource="{Binding AreaNames}"
            ItemTemplate="{StaticResource TheTabControl}">
</TabControl>

public MainViewModel()
{
    AreaNames.Add(new Area { Title = "Area1", Description = "this is the description for area 1" });
    AreaNames.Add(new Area { Title = "Area2", Description = "this is the description for area 2" });
    AreaNames.Add(new Area { Title = "Area3", Description = "this is the description for area 3" });
}

#region ViewModelProperty: AreaNames
private ObservableCollection<Area> _areaNames = new ObservableCollection<Area>();
public ObservableCollection<Area> AreaNames
{
    get
    {
        return _areaNames;
    }

    set
    {
        _areaNames = value;
        OnPropertyChanged("AreaNames");
    }
}
#endregion

What do I have to change so that my databound tabcontrol looks like my regular non-databound tabcontrol?

  • 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-11T20:05:37+00:00Added an answer on May 11, 2026 at 8:05 pm

    TabControl uses two different templates to define its structure. ItemTemplate is for the headers (the “tabs”), and ContentTemplate is for the content displayed under each tab.

    This XAML looks more like your first screenshot:

    <Window.Resources>
        <DataTemplate x:Key="TabHeaderTemplate">
            <TextBlock Text="{Binding Title}"/>
        </DataTemplate>
    
        <DataTemplate x:Key="TabItemTemplate">
            <TextBlock Text="{Binding Description}" Margin="10"/>
        </DataTemplate>
    </Window.Resources>
    
    <TabControl Width="225" Height="150" 
                ItemsSource="{Binding AreaNames}"            
                ContentTemplate="{StaticResource TabItemTemplate}"         
                ItemTemplate="{StaticResource TabHeaderTemplate}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Non-english characters are messed up in a text column. Arabic text looks like this:
How non-SOAP (REST WS, HTTP WS) web service clients knows about the structure of
I have a non databound DGV (no datasource, etc; rows added manually). To filter
Non-Technical Background info: I am working for a school and we are building a
For non-Rails work, regular Ruby works fine on my Windows 7 machine. But I'm
Non inline function defined in header file with guards #if !defined(HEADER_RANDOM_H) #define HEADER_RANDOM_H void
Custom non-fatal exception derive from which class in asp.net 3.5?
hobbyist/non-profession programmer here. I don't have a strong grasp on network addressing. I have
Grepping non printable characters doesn't seem to work for carriage return (control key ^M).
In non-ARC code retained properties handily take care of memory management for you using

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.