locked
create a wpf window in a wcf service library RRS feed

  • Question

  • Hello All,

    I have the need to create a wpf window in my wcf service library.

    I have an existing xaml and cs file that will control the workings of the window. I adding a user control, and then changing the code to my existing code, but it does not work, it gives a compilation error that there cannot be two base classes. (i've added Window)

    Can you please tell me how i can fix this, or suggest an alternate solution?

    Thank you!
    Thursday, January 12, 2012 10:43 AM

Answers

  • I found a solution myself...

    I created a usercontrol, and then edited the xaml and cs files to not derive from usercontrol anymore, but rather from Window. This worked for me.

     

    • Marked as answer by harriet_001 Friday, January 13, 2012 9:58 AM
    Friday, January 13, 2012 9:57 AM

All replies

  • Instead of adding WPF Window in WCF service library, you can create a WPF application  host WCF Service in it. Following link may help with steps to host WCF Service in managed application. You can follow those steps in your WPF application

    http://msdn.microsoft.com/en-us/library/ms731758.aspx
    http://msdn.microsoft.com/en-us/library/ms756474(v=vs.90).aspx  (Sample)


    Gaurav Khanna | Microsoft VB.NET MVP
    • Edited by Khanna Gaurav Thursday, January 12, 2012 6:42 PM
    • Proposed as answer by Horizon_Net Thursday, January 12, 2012 8:26 PM
    Thursday, January 12, 2012 6:41 PM
  • Hi,

    Your suggestion is exactly what I have. My WCF is hosted in a WPF. In WCF i construct a singleton class, that is databound to some controls in my WPF, and it works great.

     

    However, the new functionality that I want to add is a popupwindow, that pops up when a WCF method is called. I would like to control this popup directly from my WCF, and I was wondering if this could be possible?

    Any suggestions welcomed.

    Regards,

    Harriet

    Friday, January 13, 2012 9:34 AM
  • I found a solution myself...

    I created a usercontrol, and then edited the xaml and cs files to not derive from usercontrol anymore, but rather from Window. This worked for me.

     

    • Marked as answer by harriet_001 Friday, January 13, 2012 9:58 AM
    Friday, January 13, 2012 9:57 AM