Add Event Object
WinWrap® Basic is an embedded language control available for .NET/COM 32/64 bit Windows applications. The WinWrap® Basic Component is compatible with VBA, Sax Basic, VB.NET and Visual Basic 6.0 style scripts.
Display custom WPF XAML UI Dialogs from WinWrap® Basic scripts. Incorporate WPF controls. Show custom user interfaces.
Use Custom WPF XAML UI Forms with your WinWrap® Basic Application
- Utilize any Windows Presentation Foundation (WPF) UI Control
- Works with .NET, WPF, and COM applications
- Dynamically display custom WPF UI from XAML description code
- Implement custom user interfaces for specific clients
- Enable power users to implement their own custom interfaces
- Access host application specific extensions
- Requires WinWrap® Basic with WWB-NET scripting option


WinWrap® Basic WPF XAML Field Update Example
- The XAML definition specifies the "Field Update" dialog UI controls and layout.
-
- Use the StackPanel to place the XAML controls on the HTML page
- Define top menu and menuitem mnuExit
- Define textbox firstNameTextBox
- Define textbox lastNameTextBox
- Define textblock fullNameTextBox
using System;
using System.Windows.Forms;
using WinWrapSamples.AddEvtObExtensions;
namespace WinWrapSamples.AddEvtOb
{
public partial class Form1 : Form
{
private MessageArea MessageArea { get { return Host.MessageArea; } }
public Form1()
{
InitializeComponent();
MessageArea.MessageAreaChanged += MessageArea_MessageAreaChanged;
}
void MessageArea_MessageAreaChanged()
{
textBox1.Text = MessageArea.Text + " at " + MessageArea.TheTime.ToString() + ".";
}
private void Form1_Load(object sender, EventArgs e)
{
basicIdeCtl1.AddExtension("#", MessageArea.GetType().Assembly);
basicIdeCtl1.AddExtension("Imports WinWrapSamples.AddEvtObExtensions", null);
basicIdeCtl1.AddExtension("Imports WinWrapSamples.AddEvtObExtensions.Host", null);
basicIdeCtl1.FileName = "Macro-Form1.bas";
}
}
}
- "Sub Main" calls the Show method in the NameDialog Class script to display the XAML dialog
using System;
namespace WinWrapSamples.AddEvtObExtensions
{
public class Host
{
static private MessageArea messageArea_ = new MessageArea();
static public MessageArea MessageArea { get { return messageArea_; } }
}
}
- Create the dialog object and then call its Show method.
-
- Define the dialog window and .NET framework controls
- Read and instantiate the WPF window
- Show the XAML Dialog
- Bind the .NET framework controls to the instantiated XAML dialog elements
- Sink the "txtFirstName_TextChanged" events
- Sink the "txtLastName_TextChanged" events
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WinWrapSamples.AddEvtObExtensions
{
public class MessageArea
{
public event Action MessageAreaChanged;
private string text_;
public string Text {
get { return text_; }
set
{
text_ = value;
TheTime = DateTime.Now;
MessageAreaChanged();
}
}
public DateTime TheTime { get; private set; }
}
}
- You can download XamlDialog.zip clicking the following link:
WinWrap® Basic WPF XAML Field Update example.
Then open the Sample.wwp project with WinWrap® Director. WinWrap® Director is part of the WinWrap® Basic Scripting evaluation product.
'#Language "WWB.NET"
Sub Main()
MessageArea.Text = "This MessageArea.Text was set from Macro-Form1.bas"
End Sub
Copyright Polar Engineering, Inc.