Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic KeyDown event not coming (Read 2084 times)
PetrOs
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 36
Joined: May 26th, 2011
KeyDown event not coming
May 16th, 2012 at 8:20am
Print Post  
Hello,

I have my subclass of the diagram class (BoundDiagram). I wanted to get some KeyDown events and process them in my ViewModel. I however cant connect to any of the keydown event - my handlers never get called. I tried in XAML:

KeyDown = "KeyDownHandler"
Keyboard.KeyDown = "KeyDownHandler"

And also tried to use Interactivity framework
Code (HTML)
Select All
<Interactivity:Interaction.Triggers>
  <Interactivity:EventTrigger EventName="KeyDown">
    <Command:EventToCommand x:Name="KeyDown" Command="{Binding KeyPressedCommand, Mode=Default}" MustToggleIsEnabledValue="True" PassEventArgsToCommand="True"/>
  </Interactivity:EventTrigger>
</Interactivity:Interaction.Triggers>
 



Nothing worked... Any idea?

Edit - it works for letter keys and spacebar, but not for arrow keys which I need to bind.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: KeyDown event not coming
Reply #1 - May 16th, 2012 at 9:54am
Print Post  
Hi,

The Diagram class has some default bindings to the arrow keys, try overriding them for your instance like this:

Code
Select All
diagram.CommandBindings.Add(
	new CommandBinding(Diagram.NavigateLeft, (sender, args) =>
	{
		DiagramNode node = diagram.ActiveItem as DiagramNode;
		if (node != null)
			node.Move(node.Bounds.Left - 10, node.Bounds.Top);
	}));
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint