views:

58

answers:

2

Hello!

What is the simplest way of converting my .NET C# windows forms app to a silverlight app?

Thanks!

+3  A: 

You will need to re-write all GUI completely. If you used any pattern separating business logic and data model from its presentation (MVC, MVP) it will be easier to port user interaction. If you used any database access layers or framework, they can most certainly be reused in Silverlight project. However, if your application logic is defined in form event handlers and data access is performed from within them, chances are high that you'll have to write a new application.

Also note that you can't use third-party libraries compiled for standard .NET Framework in Silverlight. You'll either need to recompile them, provided that you have the sources, or look for a specific Silverlight version of the binaries.

Standard .NET Framework libraries can easily be accessed, however there are some exceptions to the rule. For example, obviously, there is not System.Windows.Forms in Silverlight subset of .NET Framework.

To give you a better answer, I need more details: what kind of application are you considering to port, what libraries does it use, whether business logic is separated from presentation logic, etc.

gaearon
Actually with Silverlight 4 you can use standard .NET libraries in Silverlight, provided you don't use classes that are not [yet] available on Silverlight.
Francesco De Vittori
Thanks, I edited the answer to reflect this better.
gaearon
A: 

Regarding the UI there is a Windows Forms to XAML Converter that may help a bit.

the empirical programmer