When this property is set to True, the child??™s Cursor property
is ignored, and the parent??™s Cursor property applies everywhere inside.
If you want to apply a cursor setting to every element in every window of an application,
the FrameworkElement.Cursor property won??™t help you. Instead, you need to use the shared
Mouse.OverrideCursor property, which overrides the Cursor property of every element:
Mouse.OverrideCursor = Cursors.Wait
To remove this application-wide cursor override, set the Mouse.OverrideCursor property
to Nothing.
Lastly, WPF supports custom cursors without any fuss. You can use both ordinary .cur
cursor files (which are essentially small bitmaps) and .ani animated cursor files. To use a custom
cursor, you pass the file name of your cursor file or a stream with the cursor data to the
constructor of the Cursor object:
Dim customCursor As New Cursor(Path.Combine(applicationDir, "stopwatch.ani")
Me.Cursor = customCursor
CHAPTER 7 n CLASSIC CONTROLS 193
The Cursor object doesn??™t directly support the URI resource syntax that allows other WPF
elements (such as the Image) to use files that are stored in your compiled assembly. However,
it??™s still quite easy to add a cursor file to your application as a resource and then retrieve it
as a stream that you can use to construct a Cursor object.
Pages:
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378