Create a new WPF project and add the following code and call it right after the generated call to InitializeComponent():
Steps to reproduce:
Mick
public void CreatePopups()
{
// Create a new window
Window window = new Window { Width = 300, Height = 50 };
// Set up the first level popup and hook up an event to notify us when it closes
PopupButton level1 = new PopupButton { Label = "Click (Level 1)", VerticalAlignment = VerticalAlignment.Center };
level1.PopupClosed += delegate { Debug.WriteLine("Level 1 Closed"); };
// Set up the second level popup and hook up an event to notify us when it closes
PopupButton level2 = new PopupButton { Label = "Click (Level 2)" };
level2.PopupClosed += delegate { Debug.WriteLine("Level 2 Closed"); };
// Nest the popups
level1.PopupContent = level2;
// Set some arbitrary content
level2.PopupContent = new Button { Label = "Click the 'Level 2' button again" };
window.Content = level1;
// Show the window
window.Show();
}
- Set the focus to the newly created window.
- Click the first button (Level 1) to show the second level.
- Click the second button (Level 2) to show the third level.
- Click the second button again (Level 2) to collapse the third level.
- The PopupClosed event is fired for the first button when it should not be. Only the button at "Level 2" has been closed (this fires correctly). Check the Debug window for output.
Mick