xceedsoftware / wpftoolkit

All the controls missing in WPF. Over 1 million downloads.
Other
3.9k stars 878 forks source link

Syntax error in DropDownButton.cs #1755

Open Byff70 opened 1 year ago

Byff70 commented 1 year ago

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 1 year ago

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