Hi,
Can anyone tell me ,when we click on close button in WPF it should ask for password .
Regards,
Shwetha
How to make a WPF window password protected on closing
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Jan 20, 2014, 8:19 PM EST
You have to write your code on Closing event of Window.
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
//Here prompt for password.
if(passwordiscorrect)
{
e.Cancel = false;
}
{
e.Cancel = true;
}
}
Shwetha Dali94 reputationPosted Jan 20, 2014, 8:48 PM EST
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Jan 20, 2014, 11:13 PM EST