KeyTrigger的複合鍵
-
2011年7月19日 上午 05:07
我使用Blend做鍵盤的event接收
<i:Interaction.Triggers> <ei:KeyTrigger Key="Esc"> <ei:CallMethodAction TargetObject="{Binding ElementName=qq}" MethodName="MVVM_QQ"/> </ei:KeyTrigger> </i:Interaction.Triggers>
但是我有一個這種快捷建的需求是要Ctrl+Shift+X的鍵盤事件但是Blend提供的KeyTrigger卻只能收Ctrl或是Shift
有沒有可以收三個的這種功能
謝謝
所有回覆
-
2011年7月19日 上午 06:04
-
2011年7月19日 上午 07:44
還是不行阿,在Blend裡面就會有錯誤顯示了
強制去run,程式也會當掉在<ei:KeyTrigger Key="x" Modifiers="Control,Shift" >
上面而且Blend上面的 Modifiers是單選的功能已
-
2011年7月19日 上午 08:36
您好,
我實際在我的Blend 4中測試是可以執行的,我貼一下我測試時的code,這裡我是按下組合鍵後改變背景顏色
另外您說會有錯誤顯示可以說一下顯示錯誤的資訊嗎?
<Grid x:Name="LayoutRoot" Background="White"> <i:Interaction.Triggers> <ei:KeyTrigger Key="x" Modifiers="Control,Shift" > <ei:ChangePropertyAction PropertyName="Background" TargetName="LayoutRoot"> <ei:ChangePropertyAction.Value> <SolidColorBrush Color="#FFDC6767"/> </ei:ChangePropertyAction.Value> </ei:ChangePropertyAction> </ei:KeyTrigger> </i:Interaction.Triggers> </Grid>
-
2011年7月19日 下午 01:51
我你給的程式貼到Xaml以後
在blend的錯誤訊息裡面出現
無法識別的Modifers="Control,Shift"
-
2011年7月22日 上午 09:14
-
2011年7月22日 上午 10:47我是用WPF+.NET4的專案
-
2011年7月23日 上午 05:58
您好,
如果是WPF專案的話,Modifers屬性可以改成用+號來連結就可以完成Ctrl+Shift+X的需求了
<i:Interaction.Triggers> <ei:KeyTrigger Modifiers="Control+Shift" Key="X"> <ei:ChangePropertyAction PropertyName="Background"> <ei:ChangePropertyAction.Value> <SolidColorBrush Color="#FFAB3636"/> </ei:ChangePropertyAction.Value> </ei:ChangePropertyAction> </ei:KeyTrigger> </i:Interaction.Triggers>
- 已標示為解答 oven425 2011年7月24日 下午 01:00

