Adnan Umer
Adnan Umer

Reputation: 3689

Prevent Popup From Closing on click wpf

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???

Upvotes: 3

Views: 2346

Answers (2)

BRAHIM Kamel
BRAHIM Kamel

Reputation: 13765

in your Xaml definition add this

<Popup StaysOpen="True"></Popup> 

Upvotes: 0

Fede
Fede

Reputation: 44038

Set the Popup.StaysOpen property to true:

<Popup StaysOpen="True"/>

Upvotes: 2

Related Questions