Scrollviewer blocking events

what I'm struggling today is the scrollviewer and the fact that it blocks my events.'s some xaml:

    <ScrollViewer x:Name="scrollv" Panel.ZIndex="15" Margin="8,65.5,0,22" VerticalScrollBarVisibility="Visible" Height="392.5" Background="White" IsHitTestVisible="False">
        <Grid x:Name="listaintrebari" Height="Auto" Width="301.5" HorizontalAlignment="Left" VerticalAlignment="Top" Background="White" >




So the thing is, in the grid that is inside the scrollviewer, I programmatically add UserControl questions ... which accidentally has a button with a click event. My problem is that I cannot press the button. The scrollviewer acts as an invisible screen to protect the user control and button from the evil mouse!

Any help is appreciated!

EDIT: (these are my Usercontrol questions)

x:Name="IntrebareControl" Width="330.641" Margin="0" MouseLeftButtonDown="IntrebareControl_MouseLeftButtonDown"


<Grid x:Name="LayoutRoot" ScrollViewer.VerticalScrollBarVisibility="Disabled" Margin="0,0,13,0" Height="90" >
    <Rectangle x:Name="rect" Panel.ZIndex="20" Height="90" Stroke="#FF0975A3"  >
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#1404BFD8" Offset="0.004"/>
                <GradientStop Color="#1300A7FF" Offset="0.996"/>
                <GradientStop Color="#2B0F82CC" Offset="0.459"/>
    <Image x:Name="imagine" HorizontalAlignment="Left" Margin="8,8,0,8" Width="126.667" Stretch="Fill" MouseLeftButtonDown="imagine_MouseLeftButtonDown" />
    <TextBlock x:Name="textul" Margin="138.667,8,8,22.5" TextWrapping="Wrap" Text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" FontSize="9.333"/>
    <Label x:Name="status" Content="Status" Height="22" Margin="127,0,100,0.5" VerticalAlignment="Bottom" FontSize="9.333" Background="#00894848" Foreground="Red"/>
    <Button x:Name="raspundeBtn" Content="Raspunde" HorizontalAlignment="Right" Height="18" Margin="0,0,8,4.5" VerticalAlignment="Bottom" Width="50.974" FontSize="9.333" Click="raspundeBtn_Click"/>



REEDITED ... wrong code inserted ... kind of dream here


source to share

2 answers

There may be some controls in front of your button. To click "through" a control, you can use



Can you post your comment on that?

@ after your edit: It seems that your RichTextBox and that the FlowDocument lies over the Button. Add your button as the last child of your grid.



The custom control handles the left mouse button to prevent the click from hitting the content.



Is this event recoverable?



All Articles