Insert a WPF usercontrol in a viewpart

Dear Language developers,

Has anyone ever tried to develop a plugin with a view part which would display a WPF user control? Or a view part with a user control containing an hosting element for a WPF user control?

I have tried this latter solution but I am getting trouble when trying to embed the WPF user control in the hosting element (the WPF user control is not in the list of objects to insert in the hosting element). Moreover, after I had added a WPF user control to my project, I received an error message when building the project (error message similar to the one I am receiving when I forget to close Studio when building the plugin).

Does anyone know why this does not work? Is it the plugin template which does not support WPF? Or is it a problem coming from Visual Studio Express 2013?

I would like to implement some parts of my view part (or even the whole view part) in WPF in order to improve the performance of my plugin. With a standard user control, I need to create and display objects at runtime, which is making the application slower. If I could use WPF, I would not need to create UI objects, thus making my plugin quicker.

Thank you in advance for your support.

Regards,

Laurent

Parents
  • Also please make sure that you have the following assemblies packed with your plugin:

    1. PresentationCore.dll

    2. PresentationFramework.dll

    3. System.Xaml.dll

    If you don't know how to include assemblies in your plugin package have a look here:

     

    Romulus Crisan | Translation Productivity Development Manager | SDL | (twitter) @cromica_82 | (blog) http://www.romuluscrisan.com/

  • Hi Romulus,

    I hope you had a safe trip back from San Francisco!

    I am back at working on the improvement of the CRiC plugin and, as I told you, I want to use WPF in order to improve performance and layout.

    I could get rid of the error messages mentioned in my original post by killing the XAML designer when building my plugin, thus releasing the file for Studio use. I also added the above-mentioned assemblies directly in the pluginmanifest, as you specified.

    I can now build my plugin, which contains a windows form with an elementhost. However, after I open Studio, when I try to open the Editor (which contains my viewpart), I receive the following error message:

    The component "EPO_446_CRiC_SearchViewPartUC" does not have a resource identified by the URI "/EPO_446_CRiC;component/searchviewpartuc.xaml"

    Any idea what is causing this problem? I have been searching for hours without success... I can find what is missing there.

    Thanks in advance for your support.

    Regards,

    Laurent
  • This is an error related to WPF and has nothing to do with Studio. This ca be thrown because of many reasons. Have a look on this discussion maybe they can help you:

    1.  

    2.  

    If this is not helping than you can have a look at my plugin here and try to do it exactly as I've done.

    Romulus Crisan | Translation Productivity Development Manager | SDL | (twitter) @cromica_82 | (blog) http://www.romuluscrisan.com/

  • Hi Romulus,

    I had already found the pages you suggested and tried to implement some of the suggested solutions without success. I have been spending a couple of hours in order to find a solution, without success.

    Out of curiosity, I just created a new plugin with a viewpart containing a simple hosted WPF usercontrol: it worked and I could display it in Studio. I will now stop trying to implement my new viewpart in the existing plugin. I will recreate a new plugin and build it up again step and step, hoping that the problem will not come back again.

    I do not understand what did not work when trying to implement the new viewpart in the existing plugin. The only difference I could notice is that my class and assembly do not contain underscores. Could it be that the underscores are encoded in a specific way when generating the UI?

    Thanks for your support.

    Regards,

    Laurent
Reply
  • Hi Romulus,

    I had already found the pages you suggested and tried to implement some of the suggested solutions without success. I have been spending a couple of hours in order to find a solution, without success.

    Out of curiosity, I just created a new plugin with a viewpart containing a simple hosted WPF usercontrol: it worked and I could display it in Studio. I will now stop trying to implement my new viewpart in the existing plugin. I will recreate a new plugin and build it up again step and step, hoping that the problem will not come back again.

    I do not understand what did not work when trying to implement the new viewpart in the existing plugin. The only difference I could notice is that my class and assembly do not contain underscores. Could it be that the underscores are encoded in a specific way when generating the UI?

    Thanks for your support.

    Regards,

    Laurent
Children