Prev | Current Page 367 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

The trick is using the Application.Get-
ResourceStream() method:
Dim sri As StreamResourceInfo = Application.GetResourceStream( _
New Uri("stopwatch.ani", UriKind.Relative))
Dim customCursor As New Cursor(sri.Stream)
Me.Cursor = customCursor
This code assumes that you??™ve added a file named stopwatch.ani to your project and set
its Build Action to Resource. This technique is explained in more detail in Chapter 12.
Content Controls
As you learned in Chapter 5, many of the most fundamental WPF controls are actually content
controls. These include the well-worn Label, Button, CheckBox, and RadioButton.
Labels
The simplest of all content controls is the Label control. Like any other content control, it
accepts any single piece of content you want to place inside. But what distinguishes the Label
control is its support for mnemonics??”essentially, shortcut keys that set the focus to a linked
control.
To support this functionality, the Label control adds a single property, named Target. To
set the Target property, you need to use a binding expression that points to another control.
Here??™s the syntax you must use:




The underscore in the label text indicates the shortcut key.


Pages:
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379