tags:

views:

72

answers:

4

i am working with C# windows form application i developed project in that.i like to make project design into more stylish and modern.is it possible to do like this by using WPF,if yes i like to apply WPF code without change Existing code and design,Is it possible to do like this.

For Example i am putting one button name OK if i click OK i show hai in Message Box but my button view is just usual one i like to change the button stylish using WPF without changing that click event.

A: 

if you wanna use WPF styles in a Window Form app, its not possible but you can use a WPF Host in your window form app and add your WPF user controls in that and get more or less the view you are looking for...
take a look at here : Host a WPF Control in a Win32 Application

Dr TJ
A: 

Windows forms is not WPF and WPF is not windows forms. You can NOT "style" a winforms application, at least, not easily. You would have to use some kind of "skinning" library. In most cases, your non-UI code from your winforms app can be used in the WPF app. For example, a SOAP web service or WCF service.

You can, in some cases, put a WPF control in your windows form app, and vice versa. it would be like taking your windows form app and putting in ASP.NET. You are talking about 2 different platforms.

Muad'Dib
A: 

To make these sort of architecture changes you would need to refactor all your logic away from the UI, and then rewrite the UI on top of a business or service layer.

As an example, your click event would need to have its code removed and moved to a Amodel or viewmodel, and perhaps replace the Message box with a call to a message box service, which could be stubbed for testing.

This sort of refactoring can be done slowly using the technique described by Dr TJ, or you could spend your time refactoring code out of your UI layer, and then replace the UI layer in one hit later.

benPearce
+1  A: 

So to rephrase : you want to change your program without changing it ?

IUsedToBeAPygmy