Professional OPC
Development Tools


Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

UA Live Binding on WPF windows.

24 Feb 2015 12:01 #2847 by support
No problem - here is the example (you may have to re-reference the assemblies, but besides this, it should be buildable):

File Attachment:

File Name:
File Size:9 KB

It subscribes to three OPC Unified Architecture node values, and shows them updating in WPF TextBox-es.

And here is the relevant part of code:
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
        public MainWindow()
        private void ClientOnMonitoredItemChanged(object sender, EasyUAMonitoredItemChangedEventArgs eventArgs)
            // We have passed in a reference to the target TextBox as the State property in EasyUAMonitoredItemArguments.
            var textBox = (TextBox) eventArgs.Arguments.State;
            if (eventArgs.Succeeded)
                textBox.Text = eventArgs.AttributeData.DisplayValue();
                textBox.Text = "*** Error";
        private void Window_Loaded(object sender, RoutedEventArgs e)
            // Define the target controls, the OPC data we want to monitor, and how fast.
            var arguments = new []
                new EasyUAMonitoredItemArguments(TextBox1, "http://localhost:51211/UA/SampleServer", "nsu=;i=10845", 1000),
                new EasyUAMonitoredItemArguments(TextBox2, "http://localhost:51211/UA/SampleServer", "nsu=;i=10853", 1000),
                new EasyUAMonitoredItemArguments(TextBox3, "http://localhost:51211/UA/SampleServer", "nsu=;i=10855", 1000)
            // Hook the event handler, and subscribe to OPC data
            _client.MonitoredItemChanged += ClientOnMonitoredItemChanged;
            _handles = _client.SubscribeMultipleMonitoredItems(arguments);
        private void Window_Unloaded(object sender, RoutedEventArgs e)
            // Unsubscribe from OPC data, and unhook the event handler
            _client.MonitoredItemChanged -= ClientOnMonitoredItemChanged;
        private readonly EasyUAClient _client = new EasyUAClient();
        private int[] _handles;

Note that the connection-less nature of our API makes this into a fully usable application: No extra code is needed to achieve complete resiliency against network failures, server shutdowns etc. - it will reconnect itself in case of problems.

Best regards

Please Log in or Create an account to join the conversation.

23 Feb 2015 20:18 #2843 by Gardoni
Basically I need One-Way binding, the UA tag value should be updated inside a WPF component, so I can read the value continuosly.
Made from c# code is OK for me, do you have a small example?
Thanks, Davide

Please Log in or Create an account to join the conversation.

23 Feb 2015 19:07 #2841 by support
What we call Live Binding, i.e. where the bindings can be created without manual coding (in Visual Studio designer), is only available for Windows Forms. See e.g. .

Without Live Binding, it is still possible to update a property of a WPF control with OPC data, but with some manual coding. Are you interested in an example for that? If so, one-time Read, or a Subscription?

Best regards

Please Log in or Create an account to join the conversation.

23 Feb 2015 14:39 #2840 by Gardoni
Hello, do you have a small example (c# code) on how to bind an OPC UA tag value to the text property of a WPF control in a WPF form?

VS2013 and FW4.5.1 are the targets.

Thanks, Davide Gardoni

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.058 seconds