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();
Pete
ResourcesSDK 1.1Bug
Developer Community Program Manager - XAML, WPF, Silverlight, .NETMF/Gadgeteer
10rem.net - Pete Brown's site and blog | twitter: @pete_brown
I work for the Developer Guidance group in Microsoft. Opinions are my own.
Thank you for documenting this workaround. It will be useful for developers extending the Silverlight 1.1 Alpha controls.
When we designed the UI controls, we made an implicit assumption that people would add their derivative controls to the same project and by extension they will be built into the same assembly. Unfortunately we didn't document this assumption in the code
where the assembly check happens (which you point out).
It's an add-on pack to an alpha product, so no worries :)
Pete
Developer Community Program Manager - XAML, WPF, Silverlight, .NETMF/Gadgeteer
10rem.net - Pete Brown's site and blog | twitter: @pete_brown
I work for the Developer Guidance group in Microsoft. Opinions are my own.
Psychlist1972
Contributor
6802 Points
1079 Posts
Microsoft
Moderator
FIX - ControlBase Problem in Silverlight.Samples.Controls - Resource Search Scoped only to Sample...
Jun 08, 2007 05:04 AM | LINK
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();Pete
Resources SDK 1.1 Bug
10rem.net - Pete Brown's site and blog | twitter: @pete_brown
I work for the Developer Guidance group in Microsoft. Opinions are my own.
nerddawg
Member
516 Points
123 Posts
Microsoft
Re: FIX - ControlBase Problem in Silverlight.Samples.Controls - Resource Search Scoped only to Sa...
Jun 09, 2007 02:59 PM | LINK
Thank you for documenting this workaround. It will be useful for developers extending the Silverlight 1.1 Alpha controls.
When we designed the UI controls, we made an implicit assumption that people would add their derivative controls to the same project and by extension they will be built into the same assembly. Unfortunately we didn't document this assumption in the code where the assembly check happens (which you point out).
Blog: http://nerddawg.blogspot.com
Psychlist1972
Contributor
6802 Points
1079 Posts
Microsoft
Moderator
Re: Re: FIX - ControlBase Problem in Silverlight.Samples.Controls - Resource Search Scoped only t...
Jun 09, 2007 03:41 PM | LINK
Thanks Ashish
It's an add-on pack to an alpha product, so no worries :)
Pete
10rem.net - Pete Brown's site and blog | twitter: @pete_brown
I work for the Developer Guidance group in Microsoft. Opinions are my own.