Welcome to irritatedVowel.com Sign in | Help

POKE 53280,0: Pete Brown's Blog

Silverlight, WPF, Windows Client Development, Woodworking, .NET Programming, CNC, Nature, and other topics.

Subscribe

Subscribe to my feed
Add to Technorati Favorites

My Book

Order my upcoming book, Silverlight in Action, covering Silverlight 4, ViewModel/MVVM, WCF RIA Services, MEF and more

About Pete Brown

Pete Brown is a Microsoft Developer Division Community Program Manager, focusing on Windows Client Development as well as a former Microsoft Silverlight MVP and INETA Speaker. Pete writes on a number of topics including Silverlight, WPF, .NET, woodworking and working as a consultant in the DC area. read more

Community Events


who's online

AddThis Social Bookmark Button

Fix to Inherit from Silverlight Sample Controls

(I posted this in the Silverlight Programming with .NET forum)

FYI. I ran into this problem tonight, and thought I'd post the solution here.

I am using sample controls in the SDK. In my solution, I have kept the 1.1 SDK example in its own project, as it is shipped, and I reference it from my main project.

In the Silverlight SDK Controls examples, there is a class named ControlBase. In my main project, I have a button-type control that inherits from SDK ButtonBase which inherits from ControlBase.

The SDK ControlBase constructor tries to be clever about picking up the name of the xaml file that contains the markup for the derived control. Unfortunately, it is unable to check outside of its own assembly because it calls this code:

     Assembly assembly = typeof(ControlBase).Assembly;
     string[] names = assembly.GetManifestResourceNames();

which brings back only xaml files that are part of the SL Samples assembly.Changing that line to this fixes the problem:

     Assembly assembly = this.GetType().Assembly;
     string[] names = assembly.GetManifestResourceNames();

  Add to Technorati Favorites
Posted: Sunday, June 10, 2007 9:01 PM by Pete.Brown
Filed under:

Comments

Fix for Extending Controls in SDK « Desperately Seeking Love of Sophie said:

PingBack from http://vivekdalvi.wordpress.com/2007/06/11/fix-for-extending-controls-in-sdk/
# June 10, 2007 10:58 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Enter the text you see in the image:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS