views:

198

answers:

1

i have a project that i am doing and i need to share the code between silverlight and WPF Assembly problem is that even though the wpf assembly is the owner of that file and the silverlight assembly only has a link to the file, all of the build actions are page everything is correct. if i make the silverlight assembly the owner then silverlight works and wpf doesnt, and currently with wpf being the owner i dont get any errors at all it just never styles the control like it cannot find it..

Note: both projects exists in the same solution.

this scenario builds and runs fine

wpf project

|__Themes

  |__Generic.xaml
  |__SomeControl.cs

this scenario builds and runs but will not display the control if i change them from linked to normal it will work fine.

i just want to share this source code and not have multiple versions of the same file floating around.

SilverlightProject

|__Themes

  |__"Linked"Generic.xaml
  |__"Linked"SomeControl.cs

sorry for my corny Tree view representation

+++++++ UPDATE +++++++++

i have noticed when using any linked file regardless of if it is silverlight or WPF the link file will not build into the Themes folder in the resource only the root. i used reflector to see where my resources ended up after compilation of the assembly including the linked file and they ended up in the root , so with that being said. is there a way to prevent this or a fix for this if this is indeed non intended behavior .

i would really love to get this figured out as it has been driving me insane for a while now.

A: 

Silverlight XAML and WPF XAML do not have the same namespace - so they aren't directly reusable.


My mistake - you're right - now with Silverlight 3 the namespaces are the same:

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml

What is the Build Action in the Property Pane for the XAML?

Michael S. Scherotter
Silverlight 3xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"WPFxmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"like i said if i change the silverlight from not being linked and pointing directly to the file it works fine. regardless of the namespace
AppleDrink
Build Action "Page".
AppleDrink