I'm trying to convert a C# WPF application to using MVVM. The DropDownButton I'm having an issue with is from Xceed's WPF Extended Toolkit. I'm trying to bind the closed event of the dropdownbutton to a method in my ViewModel. When the button's context menu is closed the method doesn't fire at all.
When I change the eventname to Click, the method fires no problem. I want the method to fire once the user has selected one of the items in the dropdown context menu rather than when the button itself is selected. I have tried to set the DataContext of the Context Menu (as per WPF ContextMenu woes: How do I set the DataContext of the ContextMenu?) and use a click event for the menu items themselves but with the same result - no errors but the method doesn't fire. I've also tried using different event names such as DropDownClosing, DropDownClosed, Closing and IsClosed with no success.
<xcad:DropDownButton Name="weekMonthDropButton" Background="White" Content="Chart By Week/Month" Width="150" Grid.Row="0" Grid.ColumnSpan="2">
<xcad:DropDownButton.DropDownContextMenu>
<ContextMenu>
<MenuItem Header="Week">
</MenuItem>
<MenuItem Header="Month"/>
</ContextMenu>
</xcad:DropDownButton.DropDownContextMenu>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Closed">
<ei:CallMethodAction TargetObject="{Binding}" MethodName="WeekMonthMenuClicked" />
</i:EventTrigger>
</i:Interaction.Triggers>
</xcad:DropDownButton>
I'm guessing that either I've been making a mistake in the event name or in the setting of the context but I'm new to both WPF and MVVM and I'm having difficulty debugging the problem. Any help would be greatly appreciated