Step 8. Displaying a Security Setup Window
When you create a new MM .NET WPF application, a SecuritySetupWindow 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 the steps below.
Note: When you run the MM .NET WPF New Project wizard, a File | Security Setup menu bar is automatically added to your main form's menu. If you have removed this menu bar, follow the steps below to create a new one.
- Add a new menu bar named FileSecuritySetupBar to your application's main menu for launching the Security Setup form. For details, see the Help topic Launching a Form from the Main Menu.
- Double-click on the menu bar in design mode and add the following code to the menu bar's Click event handler:
In C#:
/// <summary> /// Set security setup mode /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SecuritySetupMenuItem_Checked(object sender, RoutedEventArgs e) { mmAppWPF.SecuritySetupMode = true; this.UIHelper.ItemCollectionSecuritySetup(this.mainMenu.Items, true); } /// <summary> /// Clear security setup mode /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SecuritySetupMenuItem_Unchecked(object sender, RoutedEventArgs e) { mmAppWPF.SecuritySetupMode = false; this.UIHelper.ItemCollectionSecuritySetup(this.mainMenu.Items, false); }And in VB .NET:
''' <summary> ''' Set security setup mode ''' </summary> ''' <param name="sender"></param> ''' <param name="e"></param> Private Sub SecuritySetupMenuItem_Checked(ByVal sender As Object, ByVal e As RoutedEventArgs) mmAppWPF.SecuritySetupMode = True Me.UIHelper.ItemCollectionSecuritySetup(Me.mainMenu.Items, True) End Sub ''' <summary> ''' Clear security setup mode ''' </summary> ''' <param name="sender"></param> ''' <param name="e"></param> Private Sub SecuritySetupMenuItem_Unchecked(ByVal sender As Object, ByVal e As RoutedEventArgs) mmAppWPF.SecuritySetupMode = False Me.UIHelper.ItemCollectionSecuritySetup(Me.mainMenu.Items, False) End Sub - In your Factory.cs/vb class, create the following method override if it doesn't already exist:
In C#:
/// <summary> /// Factory method that creates the Security Setup Window /// </summary> /// <returns></returns> public override mmSecuritySetupWindow CreateSecuritySetupWindow() { return new SecuritySetupWindow(); }And in VB .NET:
''' <summary> ''' Factory method that creates the Security Setup window ''' </summary> ''' <remarks></remarks> Public Overrides Function CreateSecuritySetupWindow() As mmSecuritySetupWindow Return New SecuritySetupWindow() End Function
- In Visual Studio, open the SecuritySetupWindow.xaml.cs/vb file and uncomment the following:
- The protected class-level variables at the top of the window
- All commented code in all window methods
Securing the Security Setup Menu Bar
You should definitely make the Security Setup menu bar secure so only users with special rights can launch the User Security Setup form.
Note: In order to access the Security Setup menu bar at run time, you need to add at least one user to the UserSecurity table or one role to the RoleSecurity table for the Security Setup menu bar.
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/26/18
Comment or report problem with topic
