Step 7. Displaying a Roles Window

When you create a new MM .NET WPF application, a RoleWindow is automatically added to the project for you. This is an application-level window derived from mmBusinessWindow that you can modify to your hearts content! To get its basic functionality working, follow these steps:

  1. Open the RoleWindow.xaml.cs/vb in Visual Studio and add a reference to your business object project's namespace

  2. Next, uncomment the following lines of code:

    In C#:

    //protected Role RoleController;
    
    //this.RoleController = (Role)this.RegisterPrimaryBizObj(new Role());
    
    //this.DataContext = this.RoleController.GetAllEntities();
    
    //((IEditableCollectionView)CollectionViewSource.GetDefaultView(this.DataContext)).NewItemPlaceholderPosition =
    //    NewItemPlaceholderPosition.None;

    And in VB .NET:

    'Protected RoleController As Role
    
    'Me.RoleController = CType(Me.RegisterPrimaryBizObj(New Role()), Role)
    
    'Me.DataContext = Me.RoleController.GetAllEntities()
    
    'CType(CollectionViewSource.GetDefaultView(Me.DataContext),  _
    ' IEditableCollectionView).NewItemPlaceholderPosition = NewItemPlaceholderPosition.None

  3. Add a menu item to your project that launches the Role window

  4. Open your WPF project in Expression Blend

  5. In the Project panel, double-click RoleWindow.xaml to open it in the design surface.

  6. In the Objects and Timeline panel, select the Window element:

  7. Go to the Properties panel, and under the Common Properties section, click the DataContext property's New button:

  8. This launches the Select Object dialog. Expand the node containing the namespace of your business objects, select the RoleEntity class and click OK:

  9. Save changes to the window

© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 06/28/12
Comment or report problem with topic