Registering Business Objects with WPF
When you use a business object in an MM.NET business window or page (mmBusinessWindow, mmBusinessPage or one of their subclasses), you should register the business object with the window or page by calling the its RegisterBizObj or RegisterPrimaryBizObj method, passing a reference to the business object. This registration process allows the business object to be referenced by the form and by other controls (For more information, see the Help topic Understanding Primary Business Objects).
For example, in the following form's constructor method, a business object is instantiated and registered with the form using the RegisterPrimaryBizObj method:
In C#:
using OakLeaf.MM.Main;
using OakLeaf.MM.Main.WPF;
using OakLeaf.OrderSystem.Business; // Specify your business object namespace here
namespace OakLeaf.OrderSystem.WPF
{
/// <summary>
/// CustomerOrdersWindow class
/// </summary>
public partial class CustomerOrdersWindow : mmBusinessWindow
{
private Order Order;
/// <summary>
/// Constructor
/// </summary>
public CustomerOrdersWindow()
{
// Register the Order object as the window's primary business object
// and store a reference to the object at the window level
this.Order = (Order)this.RegisterPrimaryBizObj(new Order());
this.InitializeComponent();
}
}
}In VB .NET:
Imports OakLeaf.MM.Main
Imports OakLeaf.MM.Main.WPF
Imports OakLeaf.OrderSystem.Business ' Specify your business object namespace here
''' <summary>
''' CustomerOrdersWindow Class
''' </summary>
Public Partial Class CustomerOrdersWindow
Inherits mmBusinessWindow
Private Order As Order
''' <summary>
''' Constructor
''' </summary>
Public Sub New()
' Register the Order object as the window's primary business object
' and store a reference to the object at the window level
Me.Order = CType(Me.RegisterPrimaryBizObj(New Order()), Order)
Me.InitializeComponent()
End Sub
End ClassNotice this code casts the business object back to its specific type (Order. This is necessary because the form-level collection containing registered business objects is of the type mmBusinessObject.
Note: The registration code is placed before the call to InitializeComponent. This ensures the business object is available before any bound controls are instantiated.
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 01/27/10
Comment or report problem with topic
