因此,我在 VS2010 的全新 WPF 应用程序中删除了 MainWindow.xaml 上的标准 WPF Calendar 控件.如果我单击日历中的某一天,然后尝试单击应用程序的关闭按钮,我必须在关闭按钮上单击两次才能接受单击.就好像 Calendar 没有释放鼠标来与应用程序的其余部分进行交互一样.
So I dropped the standard WPF Calendar control on the MainWindow.xaml in a brand new WPF App in VS2010. If I click on a day in the calendar and then try to click the Close button for the app, I have to click twice on the close button before it accepts the click. It's acting as if the Calendar hasn't released the Mouse to interact with the rest of the application.
我已将 Focusable 更改为 false,但效果没有任何变化,我已尝试覆盖 PreviewOnMouseUp 并调用 ReleaseMouseCapture() 无济于事.我对 MouseLeave 和 MouseLeftButtonUp 做了同样的事情,结果相同.鉴于这些事情都不起作用,我怀疑我在叫错树.谷歌没有发现任何值得注意的东西,但也许我的 GoogleFu 今天还达不到标准.
I've changed Focusable to false, with no change in effect, and I've tried overriding the PreviewOnMouseUp and calling ReleaseMouseCapture() to no avail. I've done the same thing with MouseLeave and MouseLeftButtonUp with the same result. Given that none of those things are working I suspect I'm barking up the wrong tree. Google has turned up nothing of note, though perhaps my GoogleFu is not up to snuff today.
有什么想法吗?
您可以通过使用如下处理程序订阅日历的 PreviewMouseUp 事件来更改此行为:
You can change this behavior by subscribing to the calendar's PreviewMouseUp event with a handler like this:
private void Calendar_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (Mouse.Captured is CalendarItem)
{
Mouse.Capture(null);
}
}
这篇关于按住鼠标的 WPF 日历控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
读取 XML 时忽略空格Ignore whitespace while reading XML(读取 XML 时忽略空格)
带有检查空元素的 XML 到 LINQXML to LINQ with Checking Null Elements(带有检查空元素的 XML 到 LINQ)
在 C# 中读取带有未闭合标签的 XMLReading XML with unclosed tags in C#(在 C# 中读取带有未闭合标签的 XML)
在 C# 中使用 Html 敏捷性解析表格、单元格Parsing tables, cells with Html agility in C#(在 C# 中使用 Html 敏捷性解析表格、单元格)
使用 LINQ 从 xml 中删除元素delete element from xml using LINQ(使用 LINQ 从 xml 中删除元素)
解析格式错误的 XMLParse malformed XML(解析格式错误的 XML)