Difference between revisions of "HowTo:Inject UI into UBIK Studio"
| Line 8: | Line 8: | ||
===Goal=== | ===Goal=== | ||
The goal is to extend the existing user control list with the injected user control.<br> | The goal is to extend the existing user control list with the injected user control.<br> | ||
| − | Every time you drag an instance to a new window, the list | + | Every time you drag an instance to a new window, the mentioned list pops up. |
[[File:InjectedUserControl.png|thumb|left|735px|Extended user control list]] <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> | [[File:InjectedUserControl.png|thumb|left|735px|Extended user control list]] <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> | ||
=== Implementation === | === Implementation === | ||
| − | 1. | + | 1. Create or reuse a .Net library (DLL) project - it doesn't have to be a {{UBIK}} Module.<br> |
| − | 2. | + | 2. Add the designated control as a class deriving from System.Windows.Forms.UserControl to the project.<br> |
| + | 3.Implement the interface IUBIKEnvironmentControl for the control.<br> | ||
| + | 4. For automatic injection, add the "Export" Attribute with the "IUBIKControl" type parameter to the designated control.<br> | ||
<syntaxhighlight lang="csharp"> | <syntaxhighlight lang="csharp"> | ||
[Export(typeof(IUBIKControl))] | [Export(typeof(IUBIKControl))] | ||
public partial class TestUserControl: UserControl, IUBIKEnvironmentControl | public partial class TestUserControl: UserControl, IUBIKEnvironmentControl | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | + | 5. The user control now has a property Description and Image.<br> | |
| − | + | 6. Set the properties in the constructor of the User Control. The text of description and the image will show up in the User Control List. | |
<syntaxhighlight lang="csharp"> | <syntaxhighlight lang="csharp"> | ||
public TestUserControl() | public TestUserControl() | ||
| Line 28: | Line 30: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | + | 7. Provide the updated DLL containing your UserControl in UBIK® Studio's [Injection_Management#Injection_Folder.28s.29|Injection] folder.<br> | |
| − | + | 8. After connecting to a database with UBIK® Studio, the new control can be accessed by right-clicking or dragging a UBIK® object on a tab header - it should appear in the list of possible controls.<br><br> | |
= Window = | = Window = | ||
Revision as of 13:52, 16 June 2026
Since version 5.2 it is possible to inject UI into UBIK® Studio.
The injected UI can be displayed inside a User Control and or Window.
This article will help you to inject your UI!

