Today I hade short time to play with the addins in NAV. I created small addin which I want to share with you. It allows you to add any WPF component to the NAV page dynamically directly from NAV by just passing correct XML including XAML describing the WPF components.
What you need:
- The addin dll file
- XML passed to the addin through text or bigtext in correct time with correct values (each change of the value is reflected in the addin)
Example of XML passed to the addin
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http//schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
<Ellipse Height="53" HorizontalAlignment="Left" Name="ellipse1" Stroke="Black" VerticalAlignment="Top" Width="65" />
<Ellipse Height="53" HorizontalAlignment="Left" Margin="10,10,0,0" Name="ellipse2" Stroke="Black" VerticalAlignment="Top" Width="65" />
<Ellipse Height="53" HorizontalAlignment="Left" Margin="25,25,0,0" Name="ellipse3" Stroke="Black" VerticalAlignment="Top" Width="65" />
<Host Width="10" Height="100"/>
This XML describe in “Element” the XAML of the created components. Element Host described the attributes of the ElementHost object which hosts the WPF components (you can change the colors, size, size limits etc.). Addin element could set attributes of the addin itself.
When the addin receive this XML, it create the WPF controls and display them in the host object. Right now the elements are only passive, you cannot click on them and fire the NAV trigger (for now…;-)). I am planning to add some dynamic way how to bind the control’s events to the NAV trigger, but this would be more complex task.
When it is good to use it
E.g. when you need to display some dynamic data on the page – you could display e.g. icons, draw some lines, objects, display labels, simply everything what WPF allows you. You just needs to create correct XAML and pass it into the addin.
I wish you luck when using this addin and I want only one from you – send me screenshots how did you used the addin on the NAV page. I will public the code in future, not right now…
The addin dll and example page could be downloaded from there.