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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:03:42+00:00 2026-05-25T01:03:42+00:00

I have a TabControl that can contain a TabControl in each TabItem. There is

  • 0

I have a TabControl that can contain a TabControl in each TabItem. There is the xaml-code:

<TabControl  Height="300" Width="500" MouseWheel="TabControl_MouseWheel">
       <TabItem Header="1" Width="50">
            <TabControl MouseWheel="TabControl_MouseWheel">
                <TabItem Header="1" Width="50"></TabItem>
                <TabItem Header="2" Width="50"></TabItem>
                <TabItem Header="3" Width="50"></TabItem>
                <TabItem Header="4" Width="50"></TabItem>
                <TabItem Header="5" Width="50"></TabItem>
                <TabItem Header="6" Width="50"></TabItem>
                <TabItem Header="7" Width="50"></TabItem>
                <TabItem Header="8" Width="50"></TabItem>
                <TabItem Header="9" Width="50"></TabItem>
            </TabControl>
        </TabItem>
        <TabItem Header="2" Width="50">
            <TabControl MouseWheel="TabControl_MouseWheel">
                <TabItem Header="1" Width="50"></TabItem>
                <TabItem Header="2" Width="50"></TabItem>
                <TabItem Header="3" Width="50"></TabItem>
                <TabItem Header="4" Width="50"></TabItem>
                <TabItem Header="5" Width="50"></TabItem>
                <TabItem Header="6" Width="50"></TabItem>
                <TabItem Header="7" Width="50"></TabItem>
                <TabItem Header="8" Width="50"></TabItem>
                <TabItem Header="9" Width="50"></TabItem>
            </TabControl>
        </TabItem>
        <TabItem Header="3" Width="50"></TabItem>
        <TabItem Header="4" Width="50"></TabItem>
        <TabItem Header="5" Width="50"></TabItem>
        <TabItem Header="6" Width="50"></TabItem>
        <TabItem Header="7" Width="50"></TabItem>
        <TabItem Header="8" Width="50"></TabItem>
        <TabItem Header="9" Width="50"></TabItem>
    </TabControl>

I want to change the selected item of tabcontrols by mouse wheeling. There is MouseWheel event handler:

private void TabControl_MouseWheel(object sender, MouseWheelEventArgs e)
    {
        TabControl tabControl = sender as TabControl;
        if (tabControl != null)
        {
            if (e.Delta < 0)
            {
                if (tabControl.SelectedIndex + 1 < tabControl.Items.Count)
                    tabControl.SelectedItem = tabControl.Items[tabControl.SelectedIndex + 1];
            }
            else
            {
                if (tabControl.SelectedIndex - 1 > -1)
                    tabControl.SelectedItem = tabControl.Items[tabControl.SelectedIndex - 1];
            }
        }
    }

The problem is that scrolling with the mouse wheeling just changes the selected item in the upper TabControl. I want other TabControls to react to mouse wheeling too.

For example: if the cursor is in one of the upper TabControl items then I want them to react to mouse wheel scrolling, otherwise I want the lower TabControls items to react to the scrolling.

  • 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-25T01:03:42+00:00Added an answer on May 25, 2026 at 1:03 am

    The inner TabControls do react, but you barely notice as the outer tab switches as well, just add the line e.Handled = true at the very end of the handler and it should work as expected as the event will no longer bubble through to the outer handler.

    (By the way, as the event bubbles you can make this work only adding a handler to the event on the outer TabControl, you then need to change the logic on the handler a bit to get the “closest” TabControl though)

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

Sidebar

Related Questions

I have a WPF application that uses a TabControl. Each TabItem will contain a
I have a XAML code that should load my UserControl inside the TabControl .
I have a TabControl with multiple TabItems. In each TabItem there needs to be
I have a TabControl and each Tab can contain the same UI but with
I have a WPF TabControl that has a couple of buttons in the TabItem
I have a TabControl region in Shell.xaml: <TabControl Name=TabRegionControl prism:RegionManager.RegionName=TabRegion /> The user can
I have a TabControl that contains several tabs. Each tab has one UserControl on
I have a TabControl and each tab contains a TradeBookSetViewModel. As the Tradebook can
I have a TabControl that can be rearranged by dragging/dropping the tabs. The current
I have a WinForms TabControl that I am dynamically adding TabPages to at runtime.

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.