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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:25:04+00:00 2026-05-18T23:25:04+00:00

i have a tabcontrol. i’m trying to pass the tabcontrol as a parameter to

  • 0

i have a tabcontrol. i’m trying to pass the tabcontrol as a parameter to figure out the selected tab item so i can get the tab header name. Binding this doesn’t seem to work. ideas?

<TabControl Background="#FFF9F9F9" Height="650">
    <i:Interaction.Triggers>
        <i:EventTrigger  EventName="SelectionChanged">
            <n:ExecuteCommandAction Command="{Binding UpdateTabCommand}" Parameter="{Binding this}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>

in my viewmodel constructor i have:

_updateTabCommand = new ActionCommand< TabControl>(UpdateTab);

private method:

public void UpdateTab(TabControl tabControl)
{
    var tabItem = (TabItem)tabControl.SelectedItem;
  • 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-18T23:25:05+00:00Added an answer on May 18, 2026 at 11:25 pm

    1) Use ElementName binding.

    Example:

    <TabControl Background="#FFF9F9F9"
                Height="650"
                Name="TabControl1">
        <i:Interaction.Triggers>
            <i:EventTrigger  EventName="SelectionChanged">
                <i:InvokeCommandAction Command="{Binding UpdateTabCommand}"
                                        CommandParameter="{Binding ElementName=TabControl1}" />
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </TabControl>
    

    2) Use FindAncestor binding:

    Example:

    <i:Interaction.Triggers>
        <i:EventTrigger  EventName="SelectionChanged">
            <i:InvokeCommandAction Command="{Binding UpdateTabCommand}"
                                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=TabControl}}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with the selected item in WPF-TabControl that could be reproduced
I have close button in the header of each tab of TabControl. Tabs are
I have to add a crystal report to a tab item from a tabcontrol
I have a TabControl and each Tab can contain the same UI but with
I have a TabControl, and on the second tab is a button: <Button Name=deleteResourceBtn>
I have a TabControl that can be rearranged by dragging/dropping the tabs. The current
I have a TabControl where each tab contains a DataGrid . When the user
I have a TabControl which looks like this: <TabControl> <TabItem> <TabItem.Header> <StackPanel Orientation=Horizontal> <Canvas
I have a TabControl. The header of each TabItem contains a StackPanel with an
I have a TabControl with n tabs. I am trying to limit the TabControl's

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.