I've been stumped with this problem for a couple weeks and I'm hoping I can get some suggestions. I have 2 Prism regions. A Toolbar region which contains a ToolbarView (ToolBarTray control) and a content region that contains a DataGridView (DataGrid control).
My toolbar region has various RoutedCommands that perform commands on the DataGrid
<ToolBar ClipToBounds="False">
<Button Command="{x:Static ApplicationCommands.Undo}"
Content="Undo"/>
<Button Command="{x:Static ApplicationCommands.Redo}"
Content="Redo"/>
<Button Command="{x:Static local:CustomDataGrid.FooCommand}"
Content="Foo"/>
</ToolBar>
When my DataGrid doesn't have keyboard focus, Undo, Redo and Foo buttons will disable. When I click on the a DataGrid cell, they will re-enable. Having these buttons disable when the DataGrid loses keyboard focus can be confusing and sometimes frustrating. (Example: Deleting a row makes the DataGrid lose keyboard focus which disables all the buttons). Is there anything I can do to ensure that Undo/Redo and Foo will stay enabled and will work on the DataGrid? I've considered using IEventAggregator but I feel like that defeats the purpose of using RoutedCommands. Any suggestions would be appreciated.