InputBindings in Modal Window

Topics: Prism v4 - WPF 4
Sep 26, 2013 at 2:00 PM
How to setup InputBindings in the modal window? I can't do through the style because InputBindings is not a DependencyProperty.
<Window.InputBindings>
        <KeyBinding Key="A"
              Modifiers="Control" 
              Command="Close" />
    </Window.InputBindings>
Can't do this:
<Style x:Key="WindowRegionStyle" TargetType="Window">
                <Setter Property="Width" Value="{Binding Content.Width, RelativeSource={RelativeSource Self}}" />
                <Setter Property="Height" Value="{Binding Content.Height, RelativeSource={RelativeSource Self}}" />
                <Setter Property="WindowStyle" Value="None"/>
                <Setter Property="ResizeMode" Value="NoResize"/>
                <Setter Property="ShowInTaskbar" Value="False"/>
                <Setter Property="InputBindings"></Setter>
            </Style>
Sep 26, 2013 at 4:54 PM
Hi,

As far as I know, you can't directly setup InputBindings on a style since it isn't a DependencyProperty. Nevertheless, you can use an Attached Property with a Style to set them on all the controls of a given type in your application. I found the following thread which explains how to do this:

I tried it on a Prism "Hello World" sample app and it seems to be working fine.

Hope it helps,

Federico Martinez
http://blogs.southworks.net/fmartinez