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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:53:46+00:00 2026-05-14T00:53:46+00:00

I have the following situation: A stackpanel contains a number of elements, including some

  • 0

I have the following situation:

A stackpanel contains a number of elements, including some that are contained in a GroupBox. So something like this:

<StackPanel x:Name="stackpanel" Background="White">
    <TextBlock Text="TextBlock"/>
    <TextBlock Text="Another TextBlock"/>
    <!--plus a load of other elements and controls-->

    <GroupBox Header="GroupBoxHeader">
        <TextBlock Text="Text inside GroupBox"/>
    </GroupBox>

</StackPanel>

I want a MouseDown in the stackpanel to trigger some Storyboard, so I’ve added an EventTrigger, like this:

<EventTrigger RoutedEvent="Mouse.MouseDown" SourceName="stackpanel">
    <BeginStoryboard Storyboard="{StaticResource OnMouseDown1}"/>
</EventTrigger>

This is almost right, but the thing is – I don’t want the MouseDown to be picked up by the GroupBox’s header or border, only by its content. In other words, I want the Storyboard to begin when someone does a mousedown on anything inside the StackPanel, except GroupBox headers and borders.

Is there some way of doing this? (I’ve tried setting e.Handled to true on the GroupBox, but then its content doesn’t pick up the mousedown anymore either.)

  • 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-14T00:53:46+00:00Added an answer on May 14, 2026 at 12:53 am

    You’re on the right track. In the GroupBox handler, set e.Handled to true only if it’s not one of the options you want to trigger. A simple trick for this is that sender is the object where you assigned the handler, but e.Source is where the event actually occured. For example, if I do this:

        private void GroupBox_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.Source.Equals(sender))
            {
                //It comes from the groupbox, including the header
                e.Handled = true;
            }
            else
            {
                e.Handled = false;
            }
        }
    

    The event only reaches the parent if it came from one of the GroupBox’s children. The ones that originate with the GroupBox itself (including the header) are suppressed.

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

Sidebar

Related Questions

I have following situation: $('selector').live('click', openSite); and open site takes the event like this
I have the following situation: excel-like application, that is accessible from internet. 2 users
I have the following situation that I would like to handle in JSF. My
I have following situation <stackpanel > <ViewBox height=25/ > <tabcontrol> <tabitem> <Canvas /> </tabitem>
Let's say that I have following situation. I have many customers and many consultans,
I have the following situation: There is a windows folder that has been mounted
Situation: I have a wrapper panel UserControl like this (namespaces and visual details removed
I have the following situation: There is a tool that gets an XSLT from
I have the following situation and I'm expecting some expert advise from SO folks.
I have the following situation: I have a certain function that runs a loop

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.