Syndicate

News

My name's Marco De Sanctis and I'm an IT professional from Italy. This is my technical blog, about .NET and related application development and design technologies.

Download my Resume (.doc)

Recent Comments

7/28/2008 at 2:46 PM

Hi...What kind of problem are you experiencing?...
by Marco De Sanctis

Read more...

7/28/2008 at 12:59 PM

Very nice concept and can i expect for list box? ,...
by Sudhir Malireddy

Read more...

7/28/2008 at 9:58 AM

In aggregates the rula is: who is the rool element...
by Tommaso Caldarola

Read more...

7/22/2008 at 7:49 PM

Been there too in a past project! I remember this ...
by Mathias

Read more...

7/14/2008 at 11:50 PM

Sure I am... but if you got batches that last for ...
by Marco De Sanctis

Read more...

Recent Posts

Crunch mode is a pure waste of time, energy and money

7/31/2008 at 5:41 PM

Read more...

Double Click on the .sln file doesn't open Visual Studio on Vista

7/27/2008 at 9:02 AM

Read more...

Domain Model & Aggregates: when do master-detail associations happen?

7/22/2008 at 4:08 PM

Read more...

How I Got Started in Software Development

7/14/2008 at 12:16 AM

Read more...

Unleash the power of VisualStateManager with custom states

6/30/2008 at 12:12 AM

Read more...

Custom controls and default template in Silverlight 2 Beta 2

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

image

Now, if we place it in a Silverlight user control:

image

we obtain exactly what we expected:

image

Fair enough!

Comments

No comments posted yet.
Post Comment
Title *
Name *
Email
Url
Comment *  
Please add 3 and 8 and type the answer here: