dotnet / dotnet/wpf

In wpf with vb, there is no closing of a popup opened from another popup with the Staysopen property set to true.

Open
#11,824 0 comments 1 reaction 0 assignees View on GitHub
Bug Cost:M Priority:2
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

Image

### Description

In WPF with VB, I have a main window representing a toolbar.

A button in the main window opens a popup with the StaysOpen property set to True.

From a button in the popup, I open a second popup with StaysOpen set to False.

After the first time the second popup opens, it closes correctly.

After subsequent openings, this popup no longer closes when clicked outside its designated area.

Here is the test program.
[PopupTest.zip](https://github.com/user-attachments/files/30867393/PopupTest.zip)

### Reproduction Steps

"
























`Class MainWindow
Private Sub btnOpenPopup1_Click(sender As Object, e As RoutedEventArgs) Handles btnOpenPopup1.Click

'Affiche le popup 1
Popup1.PlacementTarget = btnOpenPopup1
Popup1.IsOpen = True
End Sub

Private Sub btnOpenPopup2_Click(sender As Object, e As RoutedEventArgs) Handles btnOpenPopup2.Click

'Affiche le popup 2
Popup2.PlacementTarget = btnOpenPopup2
Popup2.IsOpen = True
End Sub

Private Sub btnClose_Click(sender As Object, e As RoutedEventArgs) Handles btnClose.Click

'Ferme la fenêtre principale
Close()
End Sub

Private Sub btnClosePopup_Click(sender As Object, e As RoutedEventArgs) Handles btnClosePopup.Click

'Ferme les popups
Popup1.IsOpen = False
Popup2.IsOpen = False
End Sub
End Class`

### Expected behavior

The ability to always close the popup.

### Actual behavior

see description.

### Regression?

_No response_

### Known Workarounds

Not found.

### Impact

_No response_

### Configuration

.net 10

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with PopupTest.zip and the MainWindow XAML/VB handlers for Popup1 and Popup2, especially the btnOpenPopup2_Click flow and the StaysOpen settings. Reproduce repeated openings and outside clicks, then trace the WPF popup behavior involved. Done means Popup2 closes reliably outside its designated area on every opening while Popup1 remains open.

Written by the indexing model from the issue text.

Assessment

Tech stack
visualbasic
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.