How to add a passwordbox to dialog in Mahapp

给你一囗甜甜゛ 提交于 2019-12-12 18:35:28

问题


inside my wpf application i have a dialog(Mahapp control) and i need to add a passwordbox to this dialog instead of the textinput.Any ideas of how to do that.

 private async void ShowModalDialog_Click(object sender, RoutedEventArgs e)
{
    popup.IsEnabled = false;
     this.MetroDialogOptions.ColorScheme = UseAccentForDialog.IsEnabled ? MetroDialogColorScheme.Accented : MetroDialogColorScheme.Theme;
     var result = await this.ShowInputAsync("FERMETURE DE L'APPLICATION.", "Tu dois demander à tes parents pour quitter." + "\n" + "Indiquer votre mot de passe pour quitter l'application.");
     var wcf = new ServiceReferenceParent.ParentServiceClient();
     Parent par = wcf.GetParent(parent.ParentId);
    if (result == par.Password) //user pressed cancel
        Application.Current.Shutdown() ;
}

回答1:


Since there is no available implementation, you will need to create your own dialog.

See the MahApps.Metro Dialog section at github for further details whether your concern was implemented or not. You may also replace the TextBox control by a PasswordBox control in the present code. This shouldn't be a problem since we are talking about just one control which isn't actually quite different than the TextBox.

UPDATE:

As I was researching for my current project, I found an issue in the MahApps.Metro repository where someone released a login dialog. You might want to check this out. I'm going to use that now.



来源:https://stackoverflow.com/questions/23133889/how-to-add-a-passwordbox-to-dialog-in-mahapp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!