Capture parent SystemWindow on click, exit if null
- Issue MatterHackers/MCCentral#4567 Null reference error in ShowPopup.widgetRelativeTo_PositionChanged
This commit is contained in:
parent
13001df42f
commit
62055129b4
2 changed files with 7 additions and 3 deletions
|
|
@ -296,14 +296,19 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
subMenuItemButton.Click += (s, e) =>
|
||||
{
|
||||
var systemWindow = this.Parents<SystemWindow>().FirstOrDefault();
|
||||
if (systemWindow == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var subMenu = new PopupMenu(menuTheme);
|
||||
subMenuItemButton.SubMenu = subMenu;
|
||||
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
populateSubMenu(subMenu);
|
||||
|
||||
var systemWindow = this.Parents<SystemWindow>().FirstOrDefault();
|
||||
|
||||
systemWindow.ShowPopup(
|
||||
new MatePoint(subMenuItemButton)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue