3
我想創建一個StaticResource KeyBinding,但我無法弄清楚我將如何去引用它。所以,在我Window.Resources,我可能把下面的:KeyBinding是一個資源嗎?
<Window.Resources>
<ResourceDictionary>
<KeyBinding
x:Key="CtrlRightKeyBinding"
Modifiers="Control"
Key="Right"
Command="{Binding MyCommand}"
CommandParameter="{Binding DirectionInfoRight}" />
</ResourceDictionary>
</Window.Resources>
不過,我不知道該怎麼設置我的化InputBindings時取消引用它:
<Window.InputBindings>
???
</Window.InputBindings>
任何想法或建議?
很奇怪。我正在嘗試在UserControl中使用KeyBinding。如果我在Button.Resources中定義了定義,那麼您的建議就可行。但是,如果我將定義放在UserControl.Resources中,它不起作用。在這兩種情況下,都在Button.InputBindings之下。 –
Bill
2012-04-26 00:23:40