Extending User Control in Silverlight 2 Beta 2

July 1, 2008 at 5:36 am | Posted in Silverlight 2 | Leave a comment
Tags: , , ,

There is a breaking change in Beta 2 for the way user control inheritance is implemented. In Beta 1 if you have created a base class which you want to extend in other pages it is done simply replacing the base class name with “<UserControl …. “ tag as “<BaseClass …”.
But this does not work in Beta 2. To solve this problem you need declare the namespace of your library and then include it as it was done in case of including in custom controls.

Suppose my base class is BaseRnd, which is just inheriting the UserControl class

namespace RnD
    public class BaseRnd : UserControl

Child Class inheriting the BaseRnd
namespace RnD
    public partial class TestPage : BaseRnd
        public TestPage()

<myBase:BaseRnd x:Class=”RnD.TestPage”
    Width=”400″ Height=”300″>


Change the closing tag as well.
Do this and it will start working

Check out my site www.silverlightchannel.com, just started adding some articles.


Leave a Comment »

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: