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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:24:28+00:00 2026-06-04T14:24:28+00:00

I have a custom control with an event handler when you click on it.

  • 0

I have a custom control with an event handler when you click on it. Everything works and the event get fired right.

    AddHandler (cu.MouseLeftButtonDown), AddressOf Me.DoSomething

When the control resizes to show some extra information it expands. It also collapses when the user preses a button. This works alright. But now when I click where the expanded area used to be, it still fires mouse leftbuttondown on that control. I have tried to set IsHitTestVisible to false on the expanded element but it diden’t work. Here’s some xaml…

 <UserControl x:Class="MyCustomControl">
     <StackPanel>
       <Grid>
          'Stuff thats always visible
       </Grid>
    <Border IsHitTestVisible="False"   Grid.Row="1" HorizontalAlignment="left" BorderThickness="1" VerticalAlignment="top" x:Name="overView" Background="#EEEEEE" Visibility="Hidden" Margin="-325,-95,0,0" Width="auto" Height="auto" Padding="5,5,5,5" BorderBrush="#999999" CornerRadius="3,3,3,3">
        <Border IsHitTestVisible="False" x:Name="myBorder" Margin="1" Width="300" Height="225" BorderThickness="1" BorderBrush="#999999" Background="#DDDDDD" CornerRadius="3,3,3,3" HorizontalAlignment="Left" VerticalAlignment="Top">
            <Rectangle IsHitTestVisible="False" x:Name="rtgOverView">
            </Rectangle>
        </Border>
    </Border>
   </StackPanel>
 </UserControl>

The overview becomes visible when I use this code

  overView.Visibility = Windows.Visibility.Visible

And hides when I use this

  OverView.Visibility = Windows.Visibility.Collapsed

I fill the rectangle with a visualbrush. This happens when the control is loaded.

   rtgOverView.Fill = visual 

The overView gets positioned in code behind like this

    If x > 350 Then
        overView.HorizontalAlignment = Windows.HorizontalAlignment.Left
        overView.Margin = New Thickness(-325, -95, 0, 0)
    Else
        overView.HorizontalAlignment = Windows.HorizontalAlignment.Right
        overView.Margin = New Thickness(0, -95, -300, 0)
    End If

I cant use another element around my customcontrol since I also use this MouseLeftButtonDown on all different kind of controls.
I can’t figure out how the boundaries on the cu.MouseLeftButtonDown event work to fix this.

  • 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-06-04T14:24:30+00:00Added an answer on June 4, 2026 at 2:24 pm

    There was something weird going on with the size of the stackpanel. It’s like the auto property doesn’t size it smaller. I managed to fix it like this. When the mouse enters I put:

     layoutroot.ClipToBounds = False 
    

    This allows me to show content outside the control.
    When the mouse leaves I use:

     layoutroot.ClipToBounds = True
    

    The clip to bound’s somehow forces the StackPanel to size smaller.

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

Sidebar

Related Questions

I have a custom control that inherits from UserControl , and I can't get
have you ever found a problem when assigning a click event handler for your
I have a custom controls which propagates the mouse click event up the visual
Is there a way to have a custom control send events that can be
I have custom server control contains templatefield when an out button clicked the field
I have a Custom Control that has multiple textbox fields and a checkbox contained
I have a custom control that needs a minor adjustment when running on XP
I have a custom control (C#, visual studio). I want to show a tooltip
I have a custom control that displays a tryAgain button when the control is
I have a custom control that inherits from .NET's CompositeControl class. This control overrides

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.