其他分享
首页 > 其他分享> > 滚动查看器阻止事件

滚动查看器阻止事件

作者:互联网

我今天要争夺的东西是滚动查看器,它阻止了我的事件.所以,这里是一些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" >

        </Grid>

    </ScrollViewer>

所以事情是:在scrollviewer内的网格上,我以编程方式添加了问题UserControl …附带一个带有单击事件的按钮.我的问题是我无法设法单击该按钮..就像scrollviewer是就像看不见的盾一样,保护用户控件和按钮免受邪恶的Mouse!

任何帮助赞赏!

编辑:(这是我的问题Usercontrol)

   <UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:eHelper_v3"
mc:Ignorable="d"
x:Class="eHelper_v3.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"  >
        <Rectangle.Fill>
            <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"/>
            </LinearGradientBrush>
        </Rectangle.Fill>
    </Rectangle>
    <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"/>

</Grid>

已修改…插入了错误的代码…这里有点困

解决方法:

也许,按钮前面有一些控制键.要点击“通过”控件,您可以使用

IsHitTestVisible="false"

您可以发表您的CommentThat吗?

@编辑后:
好像您的RichTextBox和FlowDocument位于Button上.
将您的按钮添加为网格的最后一个子项.

标签:scrollviewer,wpf,c,routedevents
来源: https://codeday.me/bug/20191201/2082157.html