O'Reilly logo

XAML Unleashed by Adam Nathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making the Control “Lookless”

As with NumericUpDown, the PlayingCard implementation from Listing 15.3 makes assumptions about its visuals. It doesn’t have to be this way. It would be nice to remove the code that retrieves the ControlTemplate resource and applies it to a ContentControl named contentControl, and somehow make this happen with the Style applied to PlayingCard. This would leave us with the following simple property:

public string Face{  get { return face; }  set { face = value; }}

Dependency Properties

Even better, let’s go ahead and turn Face into a dependency property. Dependency properties are used throughout XAML-based UI frameworks to enable styling, automatic data binding, animation, and more. For the most part, you can do ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required