I want to create a card class (as in a playing card).
Between templates and databinding, I probably wouldn't implement a card like this. That's really tying the implementation of your card to a UI object which seems, well, wrong. For example, you could have a simple card class that exposes an int Index property,
i.e., 43 is the ace of spades. Then an instance of an Image would bind its source property to the card's Index property, and through a value converter, set the right image url. Certainly would keep your data much more cleanly separated from the presentation.
I'm a bit agnostic on the sealed vs not-sealed argument, perhaps because I haven't run into an issue that's tripped me up significantly. But for something like this, in the Silverlight/WPF/XAML/Databinding/Template world, there's really no reason to extend
an image.
jackbond
Contributor
5812 Points
1559 Posts
Re: Why are shapes sealed?
Apr 02, 2011 08:43 AM | LINK
Between templates and databinding, I probably wouldn't implement a card like this. That's really tying the implementation of your card to a UI object which seems, well, wrong. For example, you could have a simple card class that exposes an int Index property, i.e., 43 is the ace of spades. Then an instance of an Image would bind its source property to the card's Index property, and through a value converter, set the right image url. Certainly would keep your data much more cleanly separated from the presentation. I'm a bit agnostic on the sealed vs not-sealed argument, perhaps because I haven't run into an issue that's tripped me up significantly. But for something like this, in the Silverlight/WPF/XAML/Databinding/Template world, there's really no reason to extend an image.
Khet - The first Silverlight multiplayer game
Zork I: The Great Underground Empire