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 8694631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:49:46+00:00 2026-06-13T00:49:46+00:00

I am obviously missing something here. I am trying to get a textblock in

  • 0

I am obviously missing something here. I am trying to get a textblock in a tabcontrol in a WPF window. I have taken some example code from the internet and changed it slightly and now the textblock isnt showing.

EDIT
This styling seems to be responsible

    <Window.Resources>
<Style TargetType="{x:Type TabItem}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type TabItem}">
                <Grid>
                    <Border 
         Name="Border"
         Background="{DynamicResource TabSelected}"
         BorderBrush="Black" 
         BorderThickness="1,1,1,1" 
         CornerRadius="6,6,0,0" >
                        <ContentPresenter x:Name="ContentSite"
           VerticalAlignment="Center"
           HorizontalAlignment="Center"
           ContentSource="Header"
           Margin="12,2,12,2"/>
                    </Border>
                </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource TabSelected}" />
                    </Trigger>
                    <Trigger Property="IsSelected" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource TabNormal}" />
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
<Style  TargetType="{x:Type TabControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <TabPanel 
         Grid.Row="0"
         Panel.ZIndex="1" 
         Margin="0,0,4,-1" 
         IsItemsHost="True"
         Background="Transparent" />
                        <Border 
         Grid.Row="1"
         BorderBrush="Black" 
         BorderThickness="1" 
         CornerRadius="0, 12, 12, 12" >

                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</Window.Resources>

End Edit

    <Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="25"></RowDefinition>
        <RowDefinition></RowDefinition>
        <RowDefinition Height="25"></RowDefinition>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition></ColumnDefinition>
    </Grid.ColumnDefinitions> 

    <Button Content="Button" Height="23" Grid.Row="0"  HorizontalAlignment="Left" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
    <TextBox Height="27" HorizontalAlignment="Left" Grid.Row="2" Name="txtMessages" VerticalAlignment="Top" Width="200" />
    <TabControl Grid.Row="1" Grid.Column="0" Height="258" HorizontalAlignment="Left" Margin="12,15,0,0" Name="tabMainContent" VerticalAlignment="Top" Width="351">
        <TabItem Header="Assigned Printers" Name="tabInstalledPrinters" Margin="0">
            <TabItem.Content>
                <StackPanel>
                    <Grid>
                        <Grid.RowDefinitions >
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                    <TextBlock Grid.Row="0" Grid.Column="0" Name="txtDisplayText" Height="23" Width="209" Text="Im Here" Background="Aqua" Margin="20,40,30,50" />
                    </Grid>
                </StackPanel>
            </TabItem.Content>
        </TabItem>
        <TabItem Header="Options" Name="tabOptions">
            <Grid />
        </TabItem>
    </TabControl>
</Grid>

Everything is as I expect but the Textblock is not showing, I have made it Aqua to make sure I am not missing it.

Can anyone see a reason why its not showing?

  • 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-06-13T00:49:48+00:00Added an answer on June 13, 2026 at 12:49 am

    You removed a ContentPresenter from your TabControl style. Put it inside the Border:

    <Style TargetType="{x:Type TabControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <TabPanel Grid.Row="0" Panel.ZIndex="1" Margin="0,0,4,-1" IsItemsHost="True" Background="Transparent" />
                        <Border Grid.Row="1" BorderBrush="Black" BorderThickness="1" CornerRadius="0, 12, 12, 12" >
                            <ContentPresenter ContentSource="SelectedContent"/>
                        </Border>
                     </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am sure, I am missing something obvious here. I am trying to get
I'm probably missing something obvious here but here's what I'm trying to do. From
I may be missing something obvious here, but how could I rewrite this code
I must be missing something obvious here... I can't get .change() to fire on
I think I'm missing something really obvious here... must be... but for some reason
I hope I am not missing something very obvious here, I want to get
Im probably missing something painfully obvious here. Im trying to join multiple tables together
Its quite possible I'm missing something obvious here; I hope so. I have been
I am trying to use cywin to get some linux code building on a
I might be missing something obvious here, but I'm trying to define a route

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.