Professional OPC
Development Tools

logos

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.

WPF C# Examples

More
22 Feb 2015 11:06 #2833 by support
Replied by support on topic WPF C# Examples
QuickOPC, as such, works under practically any .NET project type, including WPF.

This applies fully to core features (for procedural coding model), and to Live Mapping and Reactive models.

All that's needed is to reference the QuickOPC assemblies, and instantiate objects and work with them as from any other environments.

The Live Binding model (where OPC data can be bound in VS designer to visual controls) only supports Windows Forms. Similarly, the OPC dialogs (for browsing etc.) are WinForms-based.

I am attaching a kind of "Hello World" project in WPF. It shows how to read an OPC item value, and display it in a TextBox on a WPF windows.

File Attachment:

File Name: WpfApplication1.zip
File Size:9 KB


The code that does this is below:
    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        var client = new EasyDAClient();
        var value = client.ReadItemValue("", "OPCLabs.KitServer.2", "Demo.Single");
        TextBox1.Text = (value== null) ? "" : value.ToString();
    }

Similarly, subscriptions etc. can be made (let me know if you need that) - it's only that the code-less Live Binding is not yet supported for WPF controls.

It should also be possible to create a Windows Forms user control, possible with the use of Live Binding as well, and then use a WindowsFormsHost (WPF) control to embed such user control in a WPF application; we have not tested this scenario, though.

If you let me know what are your application needs, I would be happy to provide further guidance or examples.

Best regards
Attachments:

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

More
22 Feb 2015 10:57 #2832 by support
WPF C# Examples was created by support
From: A.
Sent: Saturday, February 21, 2015 10:01 AM
To: Zbynek Zahradnik
Subject: ...

[...]

The toolkit contains C# examples using WinForms. The very first question I have is whether you provide WPF C# examples as well.

Please can you guide me where I can find these. Or, is it possible you to provide some for us in order to take our tests further?

[...]

A.

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

Moderators: support
Time to create page: 0.061 seconds