I have a context menu with menu items. Some of the menu items have children (i.e. subgroups). The context menu is adapting it's content depending on what I right-click. This is accomplished because I have attached a command to each menu item that isn't a group, and these items become disabled when the command can't run.
Since I does't want disabled items in a context menu, I have a style making all disabled menu items take the visibility property "Collapsed", making them disappear when they become disabled.
The problem now is how do I hide menu item groups when all their children are collapsed