C# Scrollviewer阻止事件
我今天要面对的是scrollviewer,它阻止了我的活动。因此..这里有一些xaml:C# Scrollviewer阻止事件,c#,wpf,scrollviewer,routedevents,C#,Wpf,Scrollviewer,Routedevents,我今天要面对的是scrollviewer,它阻止了我的活动。因此..这里有一些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="li
<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就像一个无形的盾牌,保护UserControl和按钮不受邪恶鼠标的伤害
谢谢你的帮助
编辑:(这是我的问题用户控件)
重新编辑…插入了错误的代码…这里有点昏昏欲睡也许,某个控件在你的按钮前面。单击“通过”可使用的控件
IsHitTestVisible="false"
你能发表你的评论吗
@编辑后:
它看起来像是您的RichTextBox和FlowDocument位于按钮上方。
将您的按钮添加为网格的最后一个子项。用户控件正在处理鼠标左键,因此单击不会到达内容
MouseLeftButtonDown="IntrebareControl_MouseLeftButtonDown"
那件事被提起了吗 为了防止有人在ScrollViewer阻止鼠标按钮事件触发时遇到问题,我通过为相应的UIElement设置ZIndex解决了这个问题:
<TextBlock Text="Hello World!" Panel.ZIndex="2" MouseLeftButtonUp="TextBlockMouseLeftButtonUp"/>
没有引发任何问题。我有一些应该显示的消息框。但我什么也没有得到
<TextBlock Text="Hello World!" Panel.ZIndex="2" MouseLeftButtonUp="TextBlockMouseLeftButtonUp"/>