inputbinding

XAML - How to have global inputBindings ?

Hi, I have a WPF application with several windows. I would like to define GLOBAL inputBindings. To define LOCAL inputbindings, i just declare the input in Window.InputBindings or UserControl.InputBindings. To define GLOBALs, I wish i could do the same with the Application class... <Application ....> <Application.InputBindings> ... ...

If we can't bind a MouseBinding's Command, what are we supposed to do?

I would love to be able to use a regular MouseBinding to capture a CTRL-Click event on my TextBlock. Unfortunately the Command property is not a dependency property and I'm using MVVM, so I can't bind it to my viewmodel. How could Microsoft have left out this basic functionality? Are there no easy ways to detect CTRL-Clicks and bind the...

MouseBinding overrides EventBindings in style

Hello I created a named style on an image, and in the style I set an EventBinding for the MouseDown event to a handler at the ResourceDictionary's code-behind, it worked good. When I use the image as the following: <Style TargetType="{x:Type Image}" x:Key="ImageStyle"> <EventSetter Event="MouseDown" Handler="Image_MouseDown"/> </S...

ListBox MouseBinding to Command not working

Hi ! I want to bind the MouseDoubleClick (or PreviewMouseDoubleClick) to my custom Command defined in my custom WPF Control. The problem is that it does not work. ... <Popup> ... <!--This CommandBinding **DOES NOT WORK** !--> <ListBox Grid.Row="1" x:Name="PART_lBox" ...

WPF Commands firing via Keyboard shortcuts don't set the Command Parameter

I have a command binding on the main form of my application. It is used to open details of the item that i am viewing. It has an associated keyboard shortcut. When i use the command in sub-forms i pass the object i want to open details for as a CommandParameter. This works if i attach the command to a button or a context menu, as i can ...

Can I enable PreviewClick using InputBindings in WPF?

I want to detect when a user clicks on an item on a listview, without using events as I do command binding and I don't like all the nonsense of the behaviours. I have tried this: <ListView x:Name="MainList" Margin="2,8,6,8" Background="Black" ItemsSource="{Binding Path=AssetsVM.Data, Mode=OneWay}" BorderBrush="{x:Null}" > <...

Defining InputBindings within a Style

I'm creating a WPF app using the MVVM design pattern, and I'm trying to extend the TabItem control so that it closes the tab when the user clicks the middle mouse button. I'm trying to achieve this using InputBindings, and it works very well until I try to define it within a style. I've learned that you cannot add InputBindings to a sty...

KeyBinding on a TreeViewItem

I have a typical treeview and a viewmodel. The viewmodel has an observable collection of other viewmodels that serves as a data source for the tree. public class TreeViewVM { public ObservableCollection<ItemVM> Items { get; private set; } public ItemVM SelectedItem { get; set; } } and the ItemVM : public class ItemVM { ...

Add mouse binding on data template using code only

Hi, I'm trying to make data template using a template selector. There is the code of my class : public class ModelTemplateSelector : DataTemplateSelector { public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container) { Type type = item.GetType(); Type listGen...