InputBindings in Modal Window

Topics: Prism v4 - WPF 4
Sep 26, 2013 at 3:00 PM
How to setup InputBindings in the modal window? I can't do through the style because InputBindings is not a DependencyProperty.
        <KeyBinding Key="A"
              Command="Close" />
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>
Sep 26, 2013 at 5:54 PM

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