Search code examples
wpfmahapps.metrocustomdialog

mahapp Custom dialog - error indicated in wpf


Inorder to use mahapp custom dialog, I have added a new window to my project and then replaced the xaml file from the following code:

          <Dialog:CustomDialog x:Class="GUIcode.Main_Window"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    Closing="Window_Closing" 
                    Loaded="Window_Opening"
                    xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                    xmlns:Dialog="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
        >

<textbox/>


    </Dialog:CustomDialog>

Then my c sharp code

using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;


     private void Window_Opening(object sender, RoutedEventArgs e)
            {
                this.ShowLoginDialog();
            }

    public async void ShowLoginDialog()
                {         
                    DiagnosticDialog diag_dialog = new DiagnosticDialog();

                    await this.ShowMetroDialogAsync(diag_dialog);
                }

However, there is a continuous error indicated saying : The type 'Dialog:CustomDialog' was not found. Verify that you are not misssing an assembly reference and that all referenced assemblies have been built.

MahApps.Metro.Controls.Dialogs is present in the refernece assemblies. I dont understand where the problem actually lies?


Solution

  • Instead of adding a new window add a user control.