What is the difference between using
Mouse.OverrideCursor = Cursors.Wait
and
this.Cursor = Cursors.Wait.
which one is correct ?
As I am using WPF
and C#
.
A cursor in Windows is an icon that is displayed when you move a mouse, a pen, or a trackball. Usually, a different cursor image is displayed for different activity. For instance, the default cursor is different than a wait cursor. Cursors may be different for different operating systems.
The primary way to change the mouse pointer is by setting the Control. Cursor or DefaultCursor property of a control to a new Cursor. For examples of changing the mouse pointer, see the code example in the Cursor class.
The main difference is that Mouse.OverrideCursor
will set the mouse cursor for the whole application while this.Cursor
will set it only for that specific FrameworkElement
.
So it will depend what you want to do.
If you want to show the wait cursor for the entire application use Mouse.OverrideCursor
, but if you only want to show the wait cursor over a specific part of the application use this.Cursor
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With