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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:40:35+00:00 2026-05-15T20:40:35+00:00

I am using the DevComponents TabNavigation control for WPF, and am able to add

  • 0

I am using the DevComponents TabNavigation control for WPF, and am able to add a new TabItem to the TabNavigation at a specific index, call it i, in the code-behind. Now I want to make the new TabItem the SelectedItem, by doing:

private void textBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    int i = createNewTabItem(0, "Foo");

    TabNavigation tn = (((sender as TextBlock).Parent as Grid).Parent as TabItem).Parent as TabNavigation;
    tn.SelectedItem = tn.Items[i];
}

private int createNewTabItem(int overflowSrcPageNum, String header)
{
    TabItem ti = new TabItem();
    ti.Header = header;
    tabNavigation.Items.Insert(overflowSrcPageNum + 1, ti);
    return overflowSrcPageNum + 1;
}

When I run this code, however, instead of the new TabItem being brought into view, it is brought into view and then the original tab I was on is quickly moved back into view.

If anyone has any ideas as to why this is happening, and how I can fix it please let me know. I have attached a sample of the XAML below:

    <Grid >
        <Grid.Resources>
            <ResourceDictionary>
                <Style TargetType="TextBlock">
                    <Style.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="TextDecorations" Value="Underline"></Setter>
                        </Trigger>
                    </Style.Triggers>
                    <Setter Property="Foreground" Value="White" />
                    <Setter Property="FontFamily" Value="Segoe UI" />
                    <Setter Property="FontSize" Value="11" />
                    <Setter Property="FontWeight" Value="Bold" />
                    <Setter Property="HorizontalAlignment" Value="Right" />
                    <Setter Property="Text" Value="View More..." />
                    <Setter Property="Visibility" Value="Visible" />
                    <EventSetter Event="MouseLeftButtonDown" Handler="lblMoreCpartys_MouseLeftButtonDown" />
                </Style>
            </ResourceDictionary>
        </Grid.Resources>
        <my:TabNavigation Background="Black" HorizontalAlignment="Stretch" Margin="0" Name="tabNavigation" 
                      VerticalAlignment="Stretch" MouseLeftButtonDown="tabNavigation_MouseLeftButtonDown"   
                      FontSize="12" Foreground="SteelBlue" ForceCursor="True" MouseWheel="tabNavigation_MouseWheel"
                      TabStripPlacement="Bottom">
            <TabItem Header="ITEM 1" Name="firstTabItem" FontSize="12" >
                    <TextBlock Name="firstTB" />
            </TabItem>
            <TabItem Header="ITEM 2" Name="secondTabItem" FontSize="12" >
                    <TextBlock Name="secondTB" />
            </TabItem>
        </my:TabNavigation>
    </grid>

Thanks in advance.

  • 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-15T20:40:35+00:00Added an answer on May 15, 2026 at 8:40 pm

    Try setting e.Handled to True in textBlock_MouseLeftButtonDown.

    I’m not familiar with that control, but if it works like TabControl then it has logic to bring a tab into view when it is clicked. That logic sees that the original tab was clicked, and brings it back into view after your change. Marking the EventArgs object as Handled will stop WPF from calling event handlers on parent elements, which would stop the tab from switching back.

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

Sidebar

Related Questions

Using this answer I am now able to store my projection logic in an
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using the Redis info command, I am able to get all the stats of
Using WPF/PRISM I want to log my messages through ILoggerFacade to my GUI (A
using a binary search tree I need to add to a vector all int
Using EF Code First I have an model object that has multiple properties that
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
using VB.Net2010 I need to call a C# DLL The problem I have is
Using online interfaces to a version control system is a nice way to have
Using C#.NET, i wrote a toolbar which is stored now into toolbar.cs file. I

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.