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 ...
Get XAML Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.