3

I want to prevent popup from being closing when User clicks on it. I tried it by override the OnPreviewMouseDown and setting e.Handled to true

protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
{
     base.OnPreviewMouseDown(e);
     e.Handled = true;
}

But doing this will not fire any mouse click event on child of Popup.
I also tried Popup.StaysOpen = true But this also don't work(Popup closes on click).
Is there any way to prevent Popup from closing when user clicks on it???

2 Answers 2

2

Set the Popup.StaysOpen property to true:

<Popup StaysOpen="True"/>
2
  • @adnanumer "this doesn't work" is a really detailed explanation of your current problem, and of the reason why my proposed solution does not meet your requirements.
    – Fede
    Jan 10, 2014 at 16:38
  • 1
    I have List Box in Popup and When I click on Listbox Item or Scroll Viewer Button, Popup closes. But StaysOpen property is true
    – Adnan Umer
    Jan 10, 2014 at 16:41
0

in your Xaml definition add this

<Popup StaysOpen="True"></Popup> 
1
  • I have List Box in Popup and When I click on Listbox Item or Scroll Viewer Button, Popup closes. But StaysOpen property is true
    – Adnan Umer
    Jan 10, 2014 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.