Example #1
0
        /// <summary>
        /// Shows a custom dialog with text input controls driven through
        /// a custom viewmodel class.
        /// </summary>
        internal async void RunCustomFromVm(object context)
        {
            var coord = GetService <IContentDialogService>().Coordinator;

            var customDialog = new MWindowDialogLib.Dialogs.CustomDialog(new Views.CustomDialogView());

            var customDialogViewModel = new ViewModels.CustomDialogViewModel(instance =>
            {
                coord.HideMetroDialogAsync(context, customDialog);

                System.Diagnostics.Debug.WriteLine("Custom Dialog -" + instance.Title + "- VM Result: ");
                System.Diagnostics.Debug.WriteLine("FirstName: " + instance.FirstName);
                System.Diagnostics.Debug.WriteLine(" LastName: " + instance.LastName);
            })
            {
                Title = "Custom Dialog"
            };

            customDialog.DataContext = customDialogViewModel;

            await coord.ShowMetroDialogAsync(context, customDialog);
        }