wpf in zenon

wpf in zenon

Hello,
I'm trying to insert a wpf element into Zenon following the article .Net in Zenon [part 4] from Information Unlimited but I'm having trouble accessing properties of the wpf element. Using vba code to access the properties is working without problems, but I prefer to use VSTA for this job as I'm more familiar with C#.
I've tried the following but that does not work.
C# Code:
Dim WPF As Element
Set WPF = thisProject.DynPictures.Item("Screen 0").Elements.Item("wpfel1")
valuex = CInt(Int((50 * Rnd()) - 25))
valuey = CInt(Int((50 * Rnd()) - 25))
WPF.WPFProperty("Chart", "_x") = valuex
WPF.WPFProperty("Chart", "_y") = valuey
WPF.WPFProperty("Chart", "AddValue") = True

Randomx and randomy are used for demonstration purpose only. The values are passed to a MsChart control within a wpf element.
Using the following code in a VBA macro is working without problems. The random values are plotted correct in the scatterplot.
VBA Code:
Dim WPF As Element
Set WPF = thisProject.DynPictures.Item("Screen 0").Elements.Item("wpfel1")
valuex = CInt(Int((50 * Rnd()) - 25))
valuey = CInt(Int((50 * Rnd()) - 25))
WPF.WPFProperty("Chart", "_x") = valuex
WPF.WPFProperty("Chart", "_y") = valuey
WPF.WPFProperty("Chart", "AddValue") = True

I guess I'm calling the item wpfel1 in the wrong way, but what is the correct way of calling it?
I hope someone can help me with this.

This is a migrated post! Originally posted on 04.02.2014 by user paulvs. Please be aware that information can be outdated.