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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:52:26+00:00 2026-05-30T13:52:26+00:00

I have a template like this: <Style TargetType={x:Type TabItem}> <Setter Property=Template> <Setter.Value> <ControlTemplate TargetType={x:Type

  • 0

I have a template like this:

    <Style TargetType="{x:Type TabItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid>
                        <Border Name="Border" BorderBrush="#666" BorderThickness="1,1,1,0" CornerRadius="8,8,0,0" Margin="0,0,0,-1">
                            <DockPanel>
                                <TextBlock x:Name="TabItemText" Foreground="#444" Padding="12 6 8 6" TextOptions.TextFormattingMode="Display">
                                        <ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Header"/>
                                </TextBlock>
                                <Image Source="../Resources/TabCloseButton.png" Width="8" Margin="0 2 8 0" />
                            </DockPanel>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

As you can see, I target TabItem, and along with adding some styles I also specify an image that is similar to web browser tab close icon. Now, my question is this: how do I listen to clicks on the tab items and find out if the user clicked on the tab close image so that I could actually close the tab?

So in essence, I’m looking for web browser -like tab functionality.

  • 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-30T13:52:27+00:00Added an answer on May 30, 2026 at 1:52 pm

    You could use a Button for that:

    <Button Command="{Binding CloseCommand}">
       <Image Source="../Resources/TabCloseButton.png" Width="8" Margin="0 2 8 0" />
    </Button>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say we have a XAML code like this: <Style TargetType={x:Type ListBoxItem}> <Setter Property=Template>
I'm trying to do something like this... <Style x:Key="MyBorderStyle" TargetType="Border"> <Setter Property="Padding" Value="{TemplateBinding Padding}"
I have a template like this, <Style x:Key=WaterMarkTextBoxStyle BasedOn={StaticResource {x:Type TextBox}} TargetType={x:Type TextBox}> <Setter
I have a WPF button style below: <Style x:Key=myButtonStyle TargetType={x:Type Button}> <Setter Property=Template> <Setter.Value>
If I have a Control with template like this: <Style x:Key=HomeButtonStyle TargetType={x:Type Control} >
I have created my own ControlTemplate for Button, like this: <Style x:Key=LightButtonStyle TargetType={x:Type ButtonBase}>
I have a Style for a TextBox like this: <Style x:Key=TextBox_Standard TargetType={x:Type TextBoxBase} >
I have a style for a button with a ControlTemplate something like this <Style
I'm creating a custom control called ImageFader. The style template looks like this: <ControlTemplate
I have template that looks like this: 100 template<size_t A0, size_t A1, size_t A2,

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.