C# 不显示鼠标光标
我正在使用下面的代码,希望光标能够显示出来 当数据加载时,为什么我在屏幕上看不到它?因为目前没有发生任何事情。 当我调试它时,我看到代码被调用,但屏幕上什么也没有发生C# 不显示鼠标光标,c#,wpf,xaml,mouseevent,C#,Wpf,Xaml,Mouseevent,我正在使用下面的代码,希望光标能够显示出来 当数据加载时,为什么我在屏幕上看不到它?因为目前没有发生任何事情。 当我调试它时,我看到代码被调用,但屏幕上什么也没有发生 onButtonCommand(){ Application.Current.Dispatcher.BeginInvoke((Action)(() => { System.Windows.Input.Mouse.OverrideCursor =
onButtonCommand(){
Application.Current.Dispatcher.BeginInvoke((Action)(() =>
{
System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
}));
//Get service Data
_Model.SerivceData();
Application.Current.Dispatcher.BeginInvoke((Action)(() =>
{
System.Windows.Input.Mouse.OverrideCursor = null;
}));
..您正在异步调用方法(使用BeginInvoke)。而是同步调用它(使用Invoke)
在dispatcher上启动Invoke enqueue委托,并将根据dispatcher优先级异步执行该委托。谢谢,现在我看到它被选中了!但问题是,我调用了服务,用户有一个弹出窗口,他应该把用户放进去并传递,我以前看到过,但当数据丢失时,我根本看不到它……当数据丢失时,我甚至不能用光标在屏幕上移动,知道如何解决吗?@John-这是完全不同的问题(与鼠标光标无关)。要回答这一问题,我们需要更多您发布的代码。请使用相关代码发布单独的问题以重现问题。(请不要在评论中提出与原始问题无关的后续问题,否则您的问题将不会在此处呈现给更多的观众)。
Application.Current.Dispatcher.Invoke((Action)(() =>
{
System.Windows.Input.Mouse.OverrideCursor =
System.Windows.Input.Cursors.Wait;
}));