I have several user controls which are instantiated in a ListBox. I have a button in my Window which raises NavigationCommands.Refresh
, and a CanExecute
handler to allow it to execute:
<Window.CommandBindings>
<CommandBinding Command="NavigationCommands.Refresh" CanExecute="CanAlwaysExecute" />
</Window.CommandBindings>
In each of these dynamically created usercontrols (created inside the ListBox's ItemTemplate), I have a handler for NavigationCommands.Refresh
. When I click the button in the window, should the handler I have set up in each of the usercontrols not fire? I need the command to tunnel down to each of the UCs but it's not.
<UserControl.CommandBindings>
<CommandBinding Command="NavigationCommands.Refresh" Executed="UpdateStatus" CanExecute="CanAlwaysExecute" />
</UserControl.CommandBindings>
....
<Button Width="200" Text="Refresh All" Command="NavigationCommands.Refresh"/>