posted on
Wednesday, June 11, 2008 11:37 AM |
Filed Under [
Silverlight
]
As Corrado Cavalli pointed out in his blog (sorry, it's in Italian), in Beta 1 custom controls didn't inherit their parent's default template; that means they didn't have any visual representation unless we explicitely provide a default template for them. It was a bit annoying, especially when we only needed to add some logic to standard controls, like creating a CustomTextBox that accepts only numbers, for example.
I was happy to realize that in Beta2 this limitation has gone: when building custom controls, we no longer have to create a default template for it, as it's inherited from its base class (if none is provided). Starting from Corrado's example, let's create a CustomButton class
Now, if we place it in a Silverlight user control:
we obtain exactly what we expected:
Fair enough!