0

I have a wpf application with a time consuming process i use the below code ,to change the cursor to show that it is loading

Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

and once operation is done i use this to make the cursor back to an arrow

Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow;

However my users want the loading cursor size bigger ,i tried checking for properties to increase the height and width of Cursors or Mouse ,but couldnt find any. Most of the solutions in google require to create custom loader which requires a lot of coding ,compared to the simple approach above .

krishna
  • 241
  • 1
  • 5
  • 18
  • 3
    No other (well-known) application does that, which is a hint that it might not be such a good idea after all. The "usual" way to fix this is to provide some progress indication *in the UI itself*: Offload your time consuming process into the background (using async/await or even a classic BackgroundWorker) and show progress (a spinner or a progress bar) in your WPF UI. But leave the poor user's cursor alone. ;-) – Heinzi May 23 '23 at 08:05
  • 1
    The cursor is provided by *Windows*. Its size is controlled by the user's preferences. `compared to the simple approach above` that's no different than those solutions - you still need extra code to avoid freezing the UI. Changing the cursor is just one way of showing the application is doing something in the background. You can also display a progress bar, perhaps in the application's status bar. You can display a popup window. – Panagiotis Kanavos May 23 '23 at 08:09
  • 1
    You don't need complex code to do something in the background anyway. Just `await Task.Run(()=>MySlowMethod());` is enough. You can modify the cursor, status bar, progress bar, whatever before you call `await Task.Run` and reset the UI after that call finishes. Whatever is inside `MySlowMethod()` will run in a separate thread. – Panagiotis Kanavos May 23 '23 at 08:12
  • 4
    _"However my users want the loading cursor size bigger"_ - From experience: _Never_ just accept such a requirement. _Always_ ask back "why?". You may come to the conclusion that you can provide higher value by actually solving the customers' problem rather than blindly implement the requirements they think they have. – Fildor May 23 '23 at 08:16
  • I would also recommend a spinner. Maybe a stack of them if there can be several processes. – Andy May 23 '23 at 08:55
  • @krishna: You could use a [custom cursor](https://stackoverflow.com/questions/46805/custom-cursor-in-wpf). – mm8 May 23 '23 at 12:14

0 Answers0