Hi
how does wpf handle inputbindings that fire on the same gesture, key-combination?
My task is to let "Ctrl+A" select all items in a treeview. Unless the focus in on a textbox
where the name of one of the nodes is currently edited. In this case Ctrl+A should select
all text, but not change the items selection.
Can this done purely in XAML? It'd like to get rid of Key / Mouse down handlers.
The code i have in mind, but not yet implemented, is a little like the one below, just to demonstrate the "issue"
<ControlTemplate TargetType="TreeView"><Border><Border.InputBindings><KeyBinding Key="A" Modifiers="Control" Command="{TemplateBinding SelectAllItemsCommand}" /></Border.InputBindings> ...<HierarchicalDataTemplate DataType="{x:Type vm:BlaViewModelBase}" ItemsSource="{Binding Path=BlaChildren}"><TextBox><TextBox.InputBindings><KeyBinding Key="A" Modifiers="Control" Command="{Binding Path=SelectAllTextCommand}" /></TextBox.InputBindings></TextBox></HierarchicalDataTemplate>
Actually the TextBox is collapsed most of the time an the text is just readonly, displayed by a TextBlock. The TextBox becomes visible through a DataTrigger. When it's visible / enabled then also its Input binding for "Ctrl+A" shall override the Ctr+A-binding of the border.
So the target is to disable the "Outer" Ctrl+A-command when the textbox is editing.
How can it be done?
Thx,
Chris