xceedsoftware/wpftoolkit

Syntax error in DropDownButton.cs

Opened this issue · 1 comments

Byff70 commented

This line in the GetContextMenu event handler:

if( child is FrameworkElement children && children.ContextMenu != null && children.ContextMenu.IsOpen )

will not compile. I'm not sure what "children" is supposed to represent, as there is no matching declaration in the module, nor is it an argument passed to the event handler. When I remove the first "children" from the line, the syntax error goes away, but I'm still left with a "name does not exist in this context" issue for "children." I'm not sure enough of the intent of this code to fix the problem without asking for advice.

Byff70 commented

Just to get the code to compile, I've kludged this:

if( child is FrameworkElement children && children.ContextMenu != null && children.ContextMenu.IsOpen ) { return children.ContextMenu; }

to this:

if (child is FrameworkElement) { return ((FrameworkElement)child).ContextMenu; }

Will soon find out how badly this munges the original intent...