Detecting language please wait for.......
You are currently reviewing an older revision of this page.
In the following tutorial will be explained how create an View in Studio using Window Presentation Foundation. Complete code sample can be found here.
1. First step is to create a new project in Visual Studio using Trados Studio template.
2. Create a new user control
3. Create a new class which inherits AbstractViewController class. This class will be the entry point of the application.
Add the following annotation to newly created class :
Add the following code to the class:
The plugin template by default creates a Windows Forms project. That means the libraries which we need to use to create xaml views are not imported.
Add the flowing references to your plugin: PresentationFramework.dll, System.Xaml.dll, UIAutomationProvider.dll
After adding missing libraries we are ready to create user controls from Presentation Framework. Create a new User Control and name it for example MainViewControl.xaml.
What we have until now? A User Control which inherits from System.Windows.Forms and another one from Presentation Framework.
If we take a look at GetControl() method from the class created before it returns a control from Windows Form. What we need to do is to display the WPF control inside of the Windows Forms control.
From Toolbox drag&drop an "ElementHost" to the user control from windows forms.(this element is found System.Windows.Forms.Integration).
Constructor of windows forms control should look like this: