Using Specialized Buttons

MM .NET contains several WPF buttons that possess specialized behavior and work in conjunction with associated business objects. You can associated a business object with these specialized buttons as described below. If you do not specify an associated business object, then the parent Window's primary business object is used.


Note: After dropping one of these specialized buttons on a WPF Window, you can get the default button text displayed by resetting its Content property in the Properties window.

mmButtonCancel

This button class cancels all pending changes in the associated business object by calling the parent Window's Cancel() method.

mmButtonDelete

This button class deletes the current entity in the associated business object by calling the parent Window's DeleteEntity() method. The result of the Delete operation is stored in the button's Result property which is of type Boolean. If the delete was successful, Result is set to true, otherwise it's set to false.

mmButtonNew

This button class adds a new entity to the associated business object by calling the parent Window's NewEntity() method. The new entity is stored in the button's NewEntity property which is of type mmBusinessEntity.

mmButtonSave

This button class saves pending changes in the associated business object by calling the parent Window's SaveEntity() method. The result of the Save operation is stored in the button's Result property which is of enumeration type mmSaveDataResult. Possible values in this enumeration are:

  • RulesBroken
  • RulesPassed
  • RuleWarnings
  • SaveCanceled
  • Exception

If mmButtonSave.CloseOnSave is set to true (it's false by default), the Window is automatically closed on a successful save (no broken rules or warnings).

The mmButtonSave.IsEnabled property is automatically set to True when the associated business object adds new data.

mmButtonClose

This button simply calls the parent Window's Close() method.

Associating a Business Object with the Specialized Buttons

When you associate a business object with a specialized button at design time, it causes the button to call methods of the business object at run time. In reality, the button passes the business object reference to a Window-level method that in turn calls the appropriate method on the business object (a chain-of-responsibility design pattern).

For example, if you associate an Order business object with an instance of the mmButtonSave class, when the button is clicked at run time, the button passes a reference to the Order business object to the Window-level Save method which in turn calls the Save method on the business object.

To associate a business object with a specialized button, do the following:

  1. Select the button in design mode

  2. Go the Properties Window and select the BindingSource property

  3. Select the ellipses button next to the property which displays the Binding Source Selection dialog:

  4. Select the business object you want to associate with the button and click OK. This sets the BindingSource property to the specified business object.


    Note: This binding is different than the normal data binding for WPF controls. This type of binding does not change any properties of the specialized button as is usually the case with regular data binding. Rather, the data binding specifies which business object should be affected when the button is clicked at run time.


© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/26/18
Comment or report problem with topic