private void ControlButtonCommand_Execute(object arg) { InputDialogResultActionType actionType = (InputDialogResultActionType)arg; switch (actionType) { case InputDialogResultActionType.Negative: Result = new InputDialogResult(InputDialogResultActionType.Negative, null); break; case InputDialogResultActionType.Positive: Result = new InputDialogResult(InputDialogResultActionType.Positive, Content); break; default: break; } Close(); }
public static string ShowStringInputPrompt(string windowTitle = null, string header = null, string defaultValue = null, Func <object, bool> validator = null) { InputDialogInfo info = new InputDialogInfo { WindowTitle = windowTitle ?? DefaultWindowTitle, Header = header, ContentType = typeof(InputDialogTextViewModel), ContentTemplateKey = InputDialogDefaultContentTemplateKeys.Text, CanPositiveActionExecute = validator, DefaultValue = defaultValue }; InputDialog dialog = new InputDialog { Owner = WindowHelper.GetActiveWindowInstance() }; InputDialogResult result = dialog.ShowDialog(info); return(result.ResultAction == InputDialogResultActionType.Positive ? result.GetValueRefrenceAs <InputDialogTextViewModel>().ResultValue : null); }