[英]WPF Grid doesn't fire mouse events when invisible, even though the mouse is capured
在我的WPF应用程序中,我有一个带有MouseDown,MouseUp和MouseMove事件的网格。 我希望每当我按下鼠标左键时网格消失,并在释放网格时重新出现。 问题是,当网格不可见时(Visibility.Hidden),我没有任何鼠标事件。
这是MouseDown处理程序:
private void TabHeaderOnMouseDown(object sender, MouseButtonEventArgs e)
{
tabHeader.CaptureMouse();
tabHeader.Visibility = Visibility.Hidden;
}
和MouseUp处理程序:
private void TabHeaderOnMouseUp(object sender, MouseButtonEventArgs e)
{
tabHeader.ReleaseMouseCapture();
tabHeader.Visibility = Visibility.Visible;
}
将不透明度设置为0而不是更改可见性解决了我的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.